public
Rubygem
Description: Advanced seed data handling for Rails, combining the best practices of several methods together.
Homepage: http://mbleigh.lighthouseapp.com/projects/10223-seed-fu
Clone URL: git://github.com/mbleigh/seed-fu.git
Make seed_fu work with models that have protected attributes
hmans (author)
Mon Apr 21 09:41:56 -0700 2008
commit  42ca7aba4e02c58c9fa163e25a055f92bbd35f2d
tree    29de026f7209a338d6c62cd042ed9a41cfe30668
parent  bfee2d0db61e581272512eab3ec25c376fd764ad
...
28
29
30
31
 
 
 
32
33
34
...
28
29
30
 
31
32
33
34
35
36
0
@@ -28,7 +28,9 @@ class Seeder
0
   
0
   def plant!
0
     record = get
0
-    record.attributes = @data
0
+    @data.each do |k, v|
0
+      record.send("#{k}=", v)
0
+    end
0
     record.save!
0
     puts " - #{@model_class} #{condition_hash.inspect}"
0
     record

Comments