-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
I just updated do mongoid-3.1.0 and I get this error on any state_machine I try to create. Classes without state_machine are working fine, so I opened an issue there too: https://github.com/pluginaweek/state_machine/issues/232
Exception: NoMethodError: undefined method `[]=' for nil:NilClass
–
0: [...]/mongoid-3.1.0/lib/mongoid/attributes.rb:171:in `block in write_attribute'
1: [...]/mongoid-3.1.0/lib/mongoid/threaded/lifecycle.rb:26:in `_assigning'
2: [...]/mongoid-3.1.0/lib/mongoid/attributes.rb:169:in `write_attribute'
3: [...]/mongoid-3.1.0/lib/mongoid/fields.rb:436:in `block (2 levels) in create_field_setter'
4: [...]/state_machine-1.1.2/lib/state_machine/machine.rb:1097:in `write'
5: [...]/state_machine-1.1.2/lib/state_machine/machine.rb:695:in `initialize_state'
6: [...]/state_machine-1.1.2/lib/state_machine/machine_collection.rb:31:in `block in initialize_states'
7: [...]/state_machine-1.1.2/lib/state_machine/machine_collection.rb:30:in `each_value'
8: [...]/state_machine-1.1.2/lib/state_machine/machine_collection.rb:30:in `initialize_states'
9: [...]/state_machine-1.1.2/lib/state_machine/integrations/mongoid.rb:375:in `initialize'
The exception is thrown here (/mongoid-3.1.0/lib/mongoid/attributes.rb:171:in `block in write_attribute')
attributes_before_type_cast[name.to_s] = value
because attributes_before_type_cast is nil