pluginaweek/state_machine — Issue #139: Initial state doesn't work in mongoid
Author: lexer
Created: 2011-11-05 10:31:08+00:00
State: open

State machine description:

state_machine :status, :initial => :offline do
event :offline do
transition all - :offline => :offline
end

event :available do
transition all - :available => :available
end

event :unavailable do
transition all - :unavailable => :unavailable
end
end

Helper call

= f.collection_select :status_event, user.status_transitions, :event, :human_event, :include_blank => "don't change"

Fails with "nil is not a known status value"

Than means that mongoid doesn't initialize initial state for new objects.