Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top