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

Inverse_of for embedded_in should check that reverse association exists

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

      Instead now it silently passes and later crashes when saving record with:

      <pre>
      NoMethodError: undefined method `name' for nil:NilClass
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/whiny_nil.rb:48:in `method_missing'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/paths.rb:38:in `_position'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/dirty.rb:124:in `block in setters'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/dirty.rb:123:in `each'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/dirty.rb:123:in `inject'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/dirty.rb:123:in `setters'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/atomicity.rb:105:in `_sets'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/atomicity.rb:38:in `block in _updates'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/atomicity.rb:37:in `each'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/atomicity.rb:37:in `inject'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/atomicity.rb:37:in `_updates'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence/update.rb:63:in `update'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence/update.rb:47:in `block (2 levels) in persist'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:413:in `_run_update_callbacks'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:93:in `run_callbacks'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence/update.rb:46:in `block in persist'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:423:in `_run_save_callbacks'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.4/lib/active_support/callbacks.rb:93:in `run_callbacks'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence/update.rb:45:in `persist'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence.rb:87:in `update'
      /home/andrius/.rvm/gems/ruby-1.9.2-p136/gems/mongoid-2.0.0.rc.7/lib/mongoid/persistence.rb:148:in `upsert'
      </pre>

            Assignee:
            Unassigned Unassigned
            Reporter:
            andriusch Andrius Chamentauskas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: