There was an error while loading. Please reload this page.
When only states and no transitions are defined, then each state can transition to any other state without restriction.
With unrestricted transitions, it behaves like an improved eNum.
class Post < ActiveRecord::Base include StateGate state_gate :status do state :draft state :pending state :published state :archived end end my_post = Post.new my_post.status #=> 'draft' my_post.update(status: :published) #=> 'published' my_post.status = 'archived' #=> 'archived' my_post.status = :draft #=> 'draft' my_post.status = :revoked #=> <ArgumentError>