Missing template blogs/index on Ruby on Rails project

前端 未结 6 1337
野的像风
野的像风 2020-12-29 09:11

For one of my projects I\'m getting this exception every now and then:

ActionView::MissingTemplate: Missing template blogs/index with {:handlers=>[:rx

6条回答
  •  执念已碎
    2020-12-29 09:59

    I fixed this issue (a few minutes ago – so far, so good) with this new Rails 3.1 option:

    config.action_dispatch.ignore_accept_header = true
    

    As mentioned in this Rails issue. That goes in config/application.rb.

    I tested it like so in a RSpec request test (using Capybara):

    it "should not break with HTTP_ACCEPT image/*;w=320;h=420 from iPhone" do
      page.driver.header "Accept", "image/*;w=320;h=420"
      visit "/some/path"
      page.should have_content("Some content")
    end
    

提交回复
热议问题