Created
November 4, 2010 14:52
-
-
Save shenoudab/662570 to your computer and use it in GitHub Desktop.
templates and layouts conflict
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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