I tried different models now, and I always get the same result.
model Foo
include MongoMapper::Document
key :title, String
attr_accessible :title
state_machine :state, :initial => :new do
state :new
state :faa
event :faa do
transition :new => :faa
end
end
end
in rails console:
bar = Foo.new
bar.state
=> "new"
bar.title = "something"
=> "something"
bar.valid?
=> true
bar.destroy
=> nil
bar.foo
bar.state
=> "faa"
bar.destroy
=> true
Any idea, why I am not able to delete the object in the database? I tried the log, but unfortunately it is empty.
Your state should not be named
new, because it is a reserved Ruby word. Change this status to i.e.initial, it should help.