I am an entry developer in Rails and I am doing system study of an Application developed in Ruby 1.8.7 and Rails 3.0.3. In my App, I have application_controller with an application.html.erb layout and a home_controller with a home_html.erb layout along with CRUD views. Then in my routes.rb, the default route is set as given below along with resourceful routing for home.
root :to => ‘home#index’
resources :home
In application.html.rb, we have default layout to be rendered inside which the other views need to be inserted using <%= yield %>. But I have another layout called home.html.erb whose contents are the same as that of the application.html.erb. When I run the app, the default layout is loaded from home.html.erb instead of application.html.erb. What could be the reason?
In this scenario, when home_controller index action is performed, the layout rendered is home.html.rb along with the view content since home.html.rb is with the same naming format as of the controller. When I changed it to homes.html.rb, the controller takes application.html.rb from the layouts folder.
So the solution is,
Thanks everyone.