Created
April 15, 2010 18:15
-
-
Save amrnt/367446 to your computer and use it in GitHub Desktop.
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
songs = Song.find_by_sql("SELECT * FROM songs GROUP BY genre") | |
songs.each{ |song| Genre.create!(:name => song.genre) } # Genre jahez | |
songs.each do |song| | |
genre = Genre.find_by_name(song.genre) | |
Music.create!(:genre_id => genre.id, :song_name => song.name) #Music table jahez related with Genre | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment