0

I am developing a Rails 2 application and only have the need for one layout template for my multiple controllers so I created one application.html.erb to be used and put

layout 'application'

into my ApplicationController (which all the controllers are definitely inheriting from) but the controllers still render their default layouts upon running the application.

I have seen from this page that inserting the layout method into my ApplicationController is all that is needed to make a default layout, and it seems to be overridden by the inherited controllers. Any ideas why this is happening?

Pori
  • 696
  • 3
  • 7
  • 18
  • Are there other files in your app/views/layouts? Sometimes I've seen rails 2 scaffolding create a products.html.erb there. If so, remove. – Jesse Wolgamott Aug 12 '13 at 14:47

1 Answers1

1

If there are other layout view files they will be used over the default. You need to either remove the other layout files (they will have the same name as a controller), or define layout 'application' in every controller that you want to use it.

Matt
  • 13,948
  • 6
  • 44
  • 68
  • Wow. I did not see this detail in any documentation I looked up. Thanks for the help. – Pori Aug 12 '13 at 15:22