Module: ActsAsPublicable::ActiveRecordExtension::ClassMethods

Defined in:
lib/acts_as_publicable/acts_as_publicable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_publicableObject



9
10
11
12
13
14
# File 'lib/acts_as_publicable/acts_as_publicable.rb', line 9

def acts_as_publicable
    raise ActsAsPublicable::FieldNotPresentError unless column_names.include?(:published.to_s)
    scope :by_published_state, lambda { |state| where("published = ?",state) }
    scope :published, by_published_state(true)
    scope :unpublished, by_published_state(false)
end