Override ActionController layout class method to take a view_options hash, whether or not the actual layout template is being changed:
layout "foo", view_options: {sidebar: 'special'}
layout view_options: {sidebar: 'special'}
Define a LayoutOptions module in the controller class and give it to the view helpers. It would define methods:
module LayoutOptions
def sidebar
'special'
end
def sidebar?
true
end
end
These options should be inheritable and overrideable by subclasses. Should keys be cleared when changing the layout?
Not sure if these methods should just be exposed directly to the view as sidebar
or somehow scoped to layout.sidebar
.