Is it possible to reset a default layout from within a before_filter method in Rails 3?
I have the following as my contacts_controller.rb:
cla
If for some reason you cannot modify the existing controller and/or just want to do this in a before filter you can use self.class.layout :special
here is an example:
class ProductsController < ApplicationController
layout :products
before_filter :set_special_layout
private
def set_special_layout
self.class.layout :special if @current_user.special?
end
end
It's just another way to do essential the same thing. More options make for happier programmers!!