change layout inside of action

8 views
Skip to first unread message

S Ahmed

unread,
Oct 14, 2012, 11:54:20 PM10/14/12
to rubyonra...@googlegroups.com
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?

Jeffrey Jones

unread,
Oct 14, 2012, 11:57:49 PM10/14/12
to rubyonra...@googlegroups.com
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.
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages