ActionView :: MissingTemplate after Rails 3.1 Update

After upgrading to Rails 3.1.0 and following David Rice instructions , all my controllers strangely can't find their views.

# rails s # Started GET "/units" for 127.0.0.1 at 2011-09-04 07:52:23 -0400 Unit Load (0.1ms) SELECT "units".* FROM "units" ActionView::MissingTemplate (Missing template units/index, application/index with {:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}. Searched in: ): app/controllers/units_controller.rb:9:in `index' 

units_controller.rb :

  # GET /units # GET /units.xml def index @units = Unit.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @units } end end 

Of course there is a view ( /app/views/units/index.html.erb ; it worked before the update). I feel like this is a stupid mistake, what am I missing here?

+7
source share
7 answers

It looks like you forgot to delete the following line in your development.rb:

config.action_view.debug_rjs = true

This should be removed or commented out if not using Rail Javascript.

See "jQuery: the new default" on rubyonrails.org for more information on updating http://weblog.rubyonrails.org/2011/4/21/jquery-new-default

+4
source

Like Tom said, I forgot to delete

 config.action_view.debug_rjs = true 

in /config/environments/development.rb , but at the time I posted the question, I already did it.

The thing though (rather stupidly) is that I had to restart the server after changing the configuration parameter . Reboot your servers when changing configuration settings, kids!

+2
source

Are views stored as erb, not haml? Just stabbing in the dark ...

0
source

I got the same error, but for a different reason. I had RAILS_ENV for development when I ran the cucumber tests.

export RAILS_ENV= or export RAILS_ENV=test fixed the problem.

0
source

rails generate controller A welcome pointer will generate a controller, I think this is the easiest way to generate a controller

0
source

If you are updating an old application that exists with Rails v1, you may have xml templates called .rxml. This is no longer supported in Rails 3.1 (where it was in version 3.0), so they need to be renamed to .builder.

What happened:

 units.xml.rxml 

Rename to:

 units.xml.builder 

This will affect all templates that use the XML builder. e.g. RSS, KML, etc.

0
source

I saw this problem because some of my templates were still named .rhtml instead of .erb.html

0
source

All Articles