Hello All,
We have developed the following code in application.rb
def determine_layout
if !params[:layout].blank? and params[:layout] == "print"
@layout = "print"
else
@layout = "public"
@layout = "admin" if params[:controller] =~ /admin/
end
return @layout
end
This code allows us to use link with param in URL "layout=print", so
the user can preview any page in browser without the menu, header,
footer and etc,
in this project we have only 2 layouts, but there are project where we
have 30 - 40 layouts,
does anybody know how to write this function in best way like
def determine_layout
if !params[:layout].blank? and params[:layout] == "print"
@layout = "print"
else
*** by default in controllers ***
end
return @layout
end
Regards,
Pavel
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---