Class: BackgroundCache::Controller::BackgroundCacheFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/background_cache/controller.rb

Instance Method Summary collapse

Instance Method Details

#after(controller) ⇒ Object



51
52
53
54
55
# File 'lib/background_cache/controller.rb', line 51

def after(controller)
  if @background_cache_layout
    controller.class.layout(@background_cache_layout)
  end
end

#before(controller) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/background_cache/controller.rb', line 34

def before(controller)
  cache = BackgroundCache::Config.current_cache
  if cache
    if cache[:layout] == false
      if controller.respond_to?(:active_layout)
        @background_cache_layout = controller.active_layout
      else
        @background_cache_layout = controller.send :_layout
      end
      controller.class.layout(false)
    else
      @background_cache_layout = nil
    end
  end
  true
end