I have a two versions of my application layout, which are differs only in a few lines. Consider following example:
!!!
%html
%head
# a lot of code here
%body
# some more code here
- if defined? flag and flag == true
# variant 1
- else
# variant 2
The question is, how do I pass this flag to the layout?
class ApplicationController < ActionController::Base
layout 'layout', :locals => {:flag => true} #won't work :(
# ...
end
A controller instance variable? That’s the normal way to get information to the template.