Module: Stale::Controller

Includes:
Fragments
Defined in:
lib/stale/controller.rb

Instance Method Summary collapse

Methods included from Fragments

#read_stale_fragment, #stale_fragment_exist?, #write_stale_fragment

Instance Method Details

#stale(parameters, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/stale/controller.rb', line 5

def stale(parameters, &block)
  if !perform_caching
    yield
    return
  end

  key = Stale.interface.key_for_parameters(parameters, self)
  Stale.interface.register_dependencies(key)

  if !stale_fragment_exist?(key)
    yield
    nil
  end
end