Module: Catche::Controller::ClassMethods

Defined in:
lib/catche/controller.rb

Instance Method Summary collapse

Instance Method Details

#catche(model, *args) ⇒ Object

Caches a controller action.

catche Project, :index, :resource_name => :project


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/catche/controller.rb', line 25

def catche(model, *args)
  options = args.extract_options!

  self.catche_model = model
  self.catche_resource_name = options[:resource_name] || self.catche_model.name.downcase.to_sym

  case options[:type]
    when :page then caches_page *args, options
    else            caches_action *args, options
  end
end

#catche?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/catche/controller.rb', line 37

def catche?
  self.catche_model.present?
end