Skip to content

Instantly share code, notes, and snippets.

@aviflombaum
Created July 17, 2012 00:34
Show Gist options
  • Save aviflombaum/3126142 to your computer and use it in GitHub Desktop.
Save aviflombaum/3126142 to your computer and use it in GitHub Desktop.
desc "Create a bunch of seed data for artists and songs"
task :seed_artists_and_songs => [:environment, :clear_artists_and_songs] do
# Build Song Off Artist
# Given a Song called R.E.S.P.E.C.T
# build the Aretha Franklin Artist
s = Song.create(:name => "R.E.S.P.E.C.T")
s.build_artist(:name => "Aretha Franklin")
s.save
# Build a Song for that Artist
# build song Natural Woman
# Manually Create Artist Kanye West
# Push a Song Onto an Artist
# push a song onto Kanye West
# Create Michael Jackson Artist
# Make 3 Michael Jackson Songs
# push all songs by Michael Jackson
# Delete one michael song off of michael
# Remove a Song from Artist
end
task :clear_artists_and_songs => [:environment] do
puts "Deleting all Artists and Songs...."
Artist.delete_all
Song.delete_all
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment