Module: Mongoid::Relations

Defined in:
lib/locomotive/mongoid/patches.rb

Overview

FIXME: github.com/benedikt/mongoid-tree/issues/58 We replace all the @_#name occurences by @_#name_ivar.

Defined Under Namespace

Modules: Accessors, Embedded

Instance Method Summary collapse

Instance Method Details

#reload_relationsObject



57
58
59
60
61
62
63
64
65
# File 'lib/locomotive/mongoid/patches.rb', line 57

def reload_relations
  relations.each_pair do |name, meta|
    if instance_variable_defined?("@_#{name}_ivar")
      if _parent.nil? || instance_variable_get("@_#{name}_ivar") != _parent
        remove_instance_variable("@_#{name}_ivar")
      end
    end
  end
end