There was an error while loading. Please reload this page.
state
class Post < ActiveRecord::Base include StateGate state_gate :status do state :draft, transitions_to: :pending state :pending, transitions_to: [:published, :draft] state :published, transitions_to: :archived state :archived end end Post.status_transitions #=> { draft: [:pending], #=> pending: [:draft, :published], #=> published: [:archived], #=> archived: [] } Post.status_transitions_for(:draft) #=> [:pending] Post.status_transitions_for(:pending) #=> [:draft, :published] Post.status_transitions_for(:archived) #=> []