There was an error while loading. Please reload this page.
By default, the status of a new instance is set to the first defined state. This can be changed with the default option.
default
class Post < ActiveRecord::Base include StateGate state_gate :status do state :draft state :pending state :published state :archived end end Post.new.status #=> 'draft'
class Post < ActiveRecord::Base include StateGate state_gate :status do state :draft state :pending state :published state :archived default :published end end Post.new.status #=> 'published'