There was an error while loading. Please reload this page.
true
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 = Post.new post.status #=> 'draft' post.status_transitions #=> [:pending] post.status = :pending #=> 'pending' post.status_transitions #=> [:draft, :published] post.status = :force_archived #=> 'archived' post.status_transitions #=> [] post.status = :force_draft #=> 'draft' post.status_transitions_to?(:pending) #=> true post.status_transitions_to?('pending') #=> true post.status_transitions_to?(:publised) #=> false