Displaying 1 result from an estimated 1 matches for "context_condition".
2006 Feb 02
4
How switching global layout (application.rthml <or> custom.rhtml)
...and under some
conditions ( Authenticated user, url parameter) I like to switch
globally to another layout, let''s say custom.rhtml
Like :
class AppController < ApplicationController
before_filter :context_layout
def index
end
end
# application.rb
def context_layout
if <context_condition>
layout(''custom'')
end
end
But layout() call is not available into application.rb, and writing
class AppController < ApplicationController
layout(''custom'')
def index
end
end
Works,but it''s impossible to add here test condition...