render_with_missing_template

Examples:

app/controllers/test_controller.rb

def index
# Renders template layouts/default/index if tests/index is missing
render :if_missing => {:template => "layouts/default/index"}
end

app/views/index.html.erb

<%= render :partial => "navigation2", :if_missing => false %>

<%= render :partial => "navigation2", :if_missing => => "layouts/defaults/navigation" %>

Note

app/controllers/test_controller.rb

def index
# Renders template layouts/default/index if tests/index is missing
render :if_missing => {:template => "layouts/default/index"}
end

def index
# Renders template layouts/default/index if tests/index is missing inside layout 'nowhere'. Render options are merged with default options.
# Not shure that it is good strategy to merge. May be, option is required.
render :layout => 'nowhere', :if_missing => {:template => "layouts/default/index"}
end

app/views/index.html.erb

<%= render :partial => "navigation2" %>