Reputation: 45084
I want to have a different layout for just one certain action in my Rails app. How do I do that?
Upvotes: 9
Views: 9460
Reputation: 134
layout :resolve_layout
.
.
.
private
def resolve_layout
case action_name
when "new"
"alternate"
else
"application"
end
end
Upvotes: 9
Reputation: 12868
class MyController < ApplicationController
layout "special", :only => :action
def action
#action code
end
end
Upvotes: 19
Reputation: 10420
# controller that calls the page
def action
render :layout => 'other'
end
Upvotes: 27