Sha256: 7afaf963ed72e2d36b7a5582621c3bc32a1329a054942fae18bc37b531dcbcd0
Contents?: true
Size: 614 Bytes
Versions: 2
Compression:
Stored size: 614 Bytes
Contents
class Post < ActiveRecord::Base attr_accessible :body, :status, :title belongs_to :category validates :title, presence: true, uniqueness: true validates :body, presence: true DRAFT = 'draft' REVIEWED = 'reviewed' PUBLISHED = 'published' ARCHIVED = 'archived' state_machine :status, initial: DRAFT do event :peer_review do transition DRAFT => REVIEWED end event :publish do transition REVIEWED => PUBLISHED end event :archive do transition any - ARCHIVED => ARCHIVED end event :reopen do transition any - DRAFT => DRAFT end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_admin-state_machine-0.1.1 | spec/dummy/app/models/post.rb |
active_admin-state_machine-0.1.0 | spec/dummy/app/models/post.rb |