Different layout for just one certain page in Rails
I want to have a different layout for just one certain action in my Rails app. How do I do tha开发者_C百科t?
# controller that calls the page
def action
render :layout => 'other'
end
class MyController < ApplicationController
layout "special", :only => :action
def action
#action code
end
end
layout :resolve_layout
.
.
.
private
def resolve_layout
case action_name
when "new"
"alternate"
else
"application"
end
end
精彩评论