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.