Permalink
Browse files

added seed data fixtures.

  • Loading branch information...
nysalor committed Apr 18, 2012
1 parent cf2c9df commit 830f6dae26189d4ea83b8753471a166712d50568
Showing with 22 additions and 0 deletions.
  1. +6 −0 db/fixtures/00-users.rb
  2. +8 −0 db/fixtures/01-items.rb
  3. +8 −0 db/fixtures/02-extras.rb
View
@@ -0,0 +1,6 @@
+nums = 100 - User.count
+if nums > 0
+ nums.times do
+ User.create :name => Faker::Name.first_name
+ end
+end
View
@@ -0,0 +1,8 @@
+User.all.each do |user|
+ nums = 10 - user.items.count
+ if nums > 0
+ nums.times do
+ Item.create :name => Faker::Name.first_name, :user_id => user.id
+ end
+ end
+end
View
@@ -0,0 +1,8 @@
+Item.all.each do |item|
+ nums = 10 - item.extras.count
+ if nums > 0
+ nums.times do
+ Extra.create :name => Faker::Name.first_name, :item_id => item.id
+ end
+ end
+end

0 comments on commit 830f6da

Please sign in to comment.