Skip to content

Instantly share code, notes, and snippets.

@shenoudab
Created November 4, 2010 14:52
Show Gist options
  • Save shenoudab/662570 to your computer and use it in GitHub Desktop.
Save shenoudab/662570 to your computer and use it in GitHub Desktop.
templates and layouts conflict
layout :layout_by_resource
theme :layout_by_resource
def layout_by_resource
if devise_controller?
if resource_name == :participant
if subdomain_conference && user_signed_in?
"conf_manage"
elsif subdomain_conference && participant_signed_in?
"conf_participant"
elsif subdomain_conference
theme "default"
else
"login"
end
elsif resource_name == :user
"login"
end
else
layout "application"
end
end
/* in layout_by_resource there is a lot of layouts and themes to choose from.
layout :layout_by_resource * should return layout *
theme :layout_by_resource * should return theme *
i'm looking for a solution for dynamic choose "layout" or "them".
as the above example will return error.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment