Skip to content

Instantly share code, notes, and snippets.

@sampierson
Created August 15, 2012 23:08
Show Gist options
  • Save sampierson/3364554 to your computer and use it in GitHub Desktop.
Save sampierson/3364554 to your computer and use it in GitHub Desktop.
How to create a bunch of posters in a competition
# First, create a competition and category
require 'factory_girl'
require 'faker'
Dir[Rails.root.join 'spec/factories/**/*.rb'].each {|f| require f}
(1..10).each { FactoryGirl.create(:poster_published) }
Poster.all.each { |p| p.authors = [p.submitter] }
c = Competition.first
cat = c.categories.first
Poster.all.each { |p| c.enter_poster p, cat }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment