Created
August 11, 2012 01:04
-
-
Save pullmonkey/3319679 to your computer and use it in GitHub Desktop.
dynamic select seed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3.times do |x| | |
genre = Genre.find_or_create_by_name(:name => "Genre #{x}") | |
3.times do |y| | |
artist = Artist.find_or_create_by_name(:name => "Artist #{x}.#{y}", :genre => genre) | |
3.times do |z| | |
Song.find_or_create_by_title(:title => "Song #{x}.#{y}.#{z}", :artist => artist) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should be :
3.times do |x|
genre = Genre.find_or_create_by_name(:name => "Genre #{x}")
3.times do |y|
artist = Artist.find_or_create_by_name(:name => "Artist #{x}.#{y}", :genre_id => genre.id)
3.times do |z|
Song.find_or_create_by_title(:title => "Song #{x}.#{y}.#{z}", :artist_id => artist.id)
end
end
end