Send object a message instead of directly setting the attribute

This line will lead to fail when you have nested attributes in a document.

Since the access to the property is made directly (throgh the #[] method) mongoid will store the association_attributes as a property of the document, instead of triggering the nested attributes generated method.

This little patch fixes this issue.
This commit is contained in:
Heitor Salazar Baldelli 2013-08-01 16:21:40 -03:00
parent 2069b9f1e0
commit 0fc9735137
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ module SeedFuMongoid
def seed! def seed!
data.each do |key, value| data.each do |key, value|
document[key] = value document.send :"#{key}=", value
end end
puts "#{@klass.name} #{document.attributes}" puts "#{@klass.name} #{document.attributes}"