Module: Gluttonberg::Content::Workflow::ClassMethods

Defined in:
lib/gluttonberg/content/workflow.rb

Instance Method Summary collapse

Instance Method Details

#all_approved_and_published(options = {}) ⇒ Object

Returns all records with the approved state and additionally with the publish flag set. The publish flag is managed by the Publishable mixin, so obviously it need to be included in the model for this method to work.

Extra conditions can also be passed in.



44
45
46
47
# File 'lib/gluttonberg/content/workflow.rb', line 44

def all_approved_and_published(options = {})
  options.merge!(:state => :approved , :published => true)
  all(options)  
end

#all_pending(options = {}) ⇒ Object

Returns all records with the pending state. May take additional conditions.



26
27
28
29
# File 'lib/gluttonberg/content/workflow.rb', line 26

def all_pending(options = {})
  options[:state] = :pending
  all(options)
end

#all_rejected(options = {}) ⇒ Object

Returns all records with the rejected state. May take additional conditions.



33
34
35
36
# File 'lib/gluttonberg/content/workflow.rb', line 33

def all_rejected(options = {})
  options[:state] = :rejected
  all(options)
end