Module: Catche::Controller::Base::ClassMethods

Defined in:
lib/catche/controller/base.rb

Instance Method Summary collapse

Instance Method Details

#catche(model, *args) ⇒ Object

Caches a controller action by tagging it. Supports any option parameters caches_action supports.

catche Project, :index
catche Task, :through => :project


14
15
16
17
18
19
20
# File 'lib/catche/controller/base.rb', line 14

def catche(model, *args)
  options = args.extract_options!
  tag     = Proc.new { |controller| Catche::Tag::Object.for(model, controller.class, options) }

  # Use Rails caches_action to pass along the tag
  caches_action(*args, { :tag => tag }.merge(options))
end