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

Atomic Paths error in 2.2

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.2.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Calling:

      top_level_document_instance.embedded_document_collection.find_or_create_by(
      foreign_object_id: foreign_object.id,
      foreign_object_type: foreign_object.class.to_s
      )

      works fine with mongoid-2.0.2.

      With mongoid-2.2.0, it raises:

      undefined method `insert_modifier' for #<Mongoid::Atomic::Paths::Root:0x00000009bdb5d8> (ActionView::Template::Error)
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/atomic.rb:71:in `atomic_insert_modifier'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/operations.rb:65:in `inserts'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/operations/embedded/insert.rb:34:in `block in persist'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/insertion.rb:26:in `block (3 levels) in prepare'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:414:in `_run_create_callbacks'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:94:in `run_callbacks'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:421:in `_run_save_callbacks'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:94:in `run_callbacks'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/insertion.rb:22:in `tap'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/insertion.rb:22:in `prepare'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence/operations/embedded/insert.rb:30:in `persist'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence.rb:44:in `insert'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/persistence.rb:149:in `upsert'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/relations/embedded/many.rb:93:in `block in create'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/relations/embedded/many.rb:93:in `tap'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/relations/embedded/many.rb:93:in `create'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/relations/many.rb:131:in `find_or'
      /home/user/.rvm/gems/ruby-1.9.2-p180/gems/mongoid-2.2.0/lib/mongoid/relations/many.rb:44:in `find_or_create_by'

            Assignee:
            Unassigned Unassigned
            Reporter:
            yfeldblum yfeldblum
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: