Change layout inside of action

How can I change the layout in the action method?

def show

if(params[:id] > 0)
layout :layout1
else
layout :default
end

end

Is this possible?

Have a look at this guide:

http://guides.rubyonrails.org/layouts_and_rendering.html

Please check to see if your questions are answered in the guides before
posting here.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs