Skip to content

Commit

Permalink
Add extra nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Mar 21, 2012
1 parent a751f1f commit 9d24547
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoid/relations.rb
Expand Up @@ -119,7 +119,7 @@ def referenced_one?
def reload_relations
relations.each_pair do |name, meta|
if instance_variable_defined?("@#{name}")
unless instance_variable_get("@#{name}") == _parent
if _parent.nil? || instance_variable_get("@#{name}") != _parent
remove_instance_variable("@#{name}")
end
end
Expand Down

0 comments on commit 9d24547

Please sign in to comment.