Permalink
Browse files

set instance variable instead of calling assocation assignment

  • Loading branch information...
1 parent e0afff7 commit 200f95153c9b2f39b8990b96d505650bcfe26d66 @flyerhzm committed Jan 19, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/mongoid-eager-loading/mongoid/criterion/eager_loading.rb
@@ -62,7 +62,7 @@ def setup_associations_with_ids(documents, reflection, one=true)
id_documents_map.each do |id, documents|
documents.each do |document|
- document.send("#{reflection.name}=", one ? id_associations_map[id].first : id_associations_map[id])
+ document.instance_variable_set("@#{reflection.name}", one ? id_associations_map[id].first : id_associations_map[id])
end
end
end
@@ -99,7 +99,7 @@ def setup_associations_with_foreign_keys(documents, reflection, one)
else
foreign_key_value.collect { |fkv| id_associations_map[fkv] }.flatten.uniq
end
- document.send("#{reflection.name}=", associations)
+ document.instance_variable_set("@#{reflection.name}", associations)
end
end
end

0 comments on commit 200f951

Please sign in to comment.