Skip to content

Instantly share code, notes, and snippets.

@traviskroberts
Created February 1, 2012 19:18
Show Gist options
  • Save traviskroberts/1718737 to your computer and use it in GitHub Desktop.
Save traviskroberts/1718737 to your computer and use it in GitHub Desktop.
User.populate 3 do |user|
user.name = Faker::Name.name
Interest.populate 2 do |interest|
interest.user_id = user
interest.name = Faker::Lorem.words
end
end
#<User id: 5, name: "John Smith">
#<User id: 6, name: "Jane Smith">
#<User id: 7, name: "Bob Smith">
#<Interest id: 10, user_id: 1, name: "Golf">
#<Interest id: 11, user_id: 1, name: "Tennis">
#<Interest id: 12, user_id: 2, name: "Video Games">
#<Interest id: 13, user_id: 2, name: "Soccer">
#<Interest id: 14, user_id: 3, name: "Running">
#<Interest id: 15, user_id: 4, name: "Movies">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment