Created
December 18, 2013 16:41
Revisions
-
superacidjax created this gist
Dec 18, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ # put all new_layout views in the following new folder: app/views_new_layout ## Do NOT put the views in app/views # you need a migration in Users called new_layout:boolean this does not need a default value ## The below code will assume the new layout for all users, unless they explicitly say no. ### for example, if you want to put an ajax box at the top of the new page that says #### "This is our new layout. Switch back to old one? If they click the link, then it sets the boolean to false. ##### You can also have them switch back and forth easily. If they make no preference (thus the boolean is nil,) then new layout is used. # You can reverse this logic very easily if you want to default to the old layout. # in application_controller.rb before_filter :check_for_new_layout # rails 4 ## before_action :check_for_new_layout def check_for_new_layout prepare_for_new_layout unless current_user && current_user.new_layout == false end def prepare_for_new_layout prepend_view_path Rails.root + 'app' + 'views_new_layout' end