Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created August 10, 2010 08:54
Show Gist options
  • Save bogdan/516939 to your computer and use it in GitHub Desktop.
Save bogdan/516939 to your computer and use it in GitHub Desktop.
Recommendation.transaction do
Contributor.with_user.each do |contributor|
rand(5).times do
recommendation_group = groups.rand
Recommendation.create(
:user => contributor.user,
:group => recommendation_group,
:body => Faker::Lorem.sentence(5)
)
end
end
end
#Reviews
Review.transaction do
Contributor.with_user.each do |contributor|
rand(5).times do
review_group = groups.rand
Review.create(
:user => contributor.user,
:group => review_group,
:body => Faker::Lorem.sentence(20)
#:title => Faker::Lorem.sentence(1)
)
end
end
end
#Inspirations
Inspiration.transaction do
Contributor.with_user.each do |contributor|
rand(5).times do
inspiration_group = groups.rand
contributor_books = contributor.products
if contributor_books.size > 0
Inspiration.create(
:user => contributor.user,
:group => inspiration_group,
:body => Faker::Lorem.sentence(5)
)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment