My webapp can be accessed in two different contexts. I want to be able to render the same view with two different layouts based on the context.
Is there a way to dynamically set the layout of the views based on the context? ie, if I have a param value which indicates the context type, can I change the layout dynamically?
That is a neat plugin. Very useful. Kudos and many thanks.
I
can’t find an answer in the agile rails book, but I think it is easy to
chain before_filters, so I can use multiple of these filters. Please
correct me if I am wrong.
You can have as many filters as you want. They’re run in the order you call them. If you return false in any of them, the rest of the filters after that one will not run.
before_filter can be called in application.rb
and since all controllers inherit from that, you can leverage that to your advantage.