Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2827

Integration issue with state_machine on mongoid-3.1.0

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.1.1
    • 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

            Assignee:
            durran Durran Jordan
            Reporter:
            pmor pmor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: