No such file or directory - layouts/application.html.erb

This is very frustrating. I am defining a layout for my AdminsController class index action which is as follows:

class AdminsController < ApplicationController

  before_filter :signal_child_menu   #current_tab :admin

  def index     @child_menu = true     @search_field = "name"     @crust_types = CrustType.search(params[:search], params[:page], @search_field)     render :template => 'crust_types/index'   end

end

Note that the above action uses a different controller/index combination, i.e., CrustTypeController/index in this case.

I am defining a :secondary_nav symbol in application.html.erb layout template as shown below:

            <div class='secondary-navigation'>               <%= yield :secondary_nav %>               <div class="clear"></div>             </div>

So to define contents for the symbol :secondary_nav, I created a specific layout template for the admins controller called admins.html.erb whose contents are shown below:

<% content_for :secondary_nav do %>   <%= navigation [:crust_types, :toppings] %> <% end %> <%= render :file => "layouts/application" %>

I am getting an error when I click on the Admins tab in my primary navigation menu:

No such file or directory - layouts/application

Extracted source (around line #4):

1: <% content_for :secondary_nav do %> 2: <%= navigation [:crust_types, :toppings] %> 3: <% end %> 4: <%= render :file => "layouts/application" %>

I do not understand why am I getting this error. The application is using Rails 2.1.2, but I have another application which is on Rails 2.1.0 and uses similar technique to render combination layouts without any problems.

What is it that I am missing here?

Thanks for your help.

Bharat

<%= render :file => "layouts/application" %>

That comports with your error, right? Seems too simple of a solution, but keep in mind that the application layout will be used automatically anyway, if there isn't one for the current controller.

Eric wrote:

What is it that I am missing here?

<%= render :file => "layouts/application" %>

That comports with your error, right? Seems too simple of a solution, but keep in mind that the application layout will be used automatically anyway, if there isn't one for the current controller.

Hello Eric, You are seeing something obvious that escapes me, hence the frustration. This is contained in my admins.html.erb file which in turn is stored in app/views/layouts directory off the Rails root directory. application.html.erb is the main layout file in the same directory. All I am doing is defining the :secondary_nav symbol using content_for and then delegating to the default application layout file. So why is rails complaining? Bharat