Skip to content

Instantly share code, notes, and snippets.

@Xorlev
Created December 10, 2011 09:10
Show Gist options
  • Save Xorlev/1454860 to your computer and use it in GitHub Desktop.
Save Xorlev/1454860 to your computer and use it in GitHub Desktop.
Naive data loading
# Not the most efficient method...
File.open('track1/albumData1.txt').each do |line|
album, artist, *genres = split_and_filter(line)
genres.map! { |g| Genre.find(g) }
Album.create! :id => album, :artist_id => artist, :genres => genres
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment