Sha256: 2aad0e012bae972b26c072f1a8738dbc0918d270092524951c2d00ef18732c0c
Contents?: true
Size: 636 Bytes
Versions: 7
Compression:
Stored size: 636 Bytes
Contents
module Publishable module ClassMethods def acts_as_publishable(options = {}) options = { :column => :status, :initial_state => :unpublished }.merge(options) include AASM aasm_column options[:column] aasm_state :unpublished aasm_state :published aasm_initial_state options[:initial_state] aasm_event :publish do transitions :to => :published, :from => [:unpublished] end aasm_event :unpublish do transitions :to => :unpublished, :from => [:published] end end end end ActiveRecord::Base.extend Publishable::ClassMethods
Version data entries
7 entries across 7 versions & 1 rubygems