Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def song_history
- song_okeys = Render.find(:all, :select => 'DISTINCT(song_okey)', :joins => 'LEFT OUTER JOIN projects ON renders.project_id = projects.id LEFT OUTER JOIN users ON projects.user_id = users.id', :conditions => ['users.id = ?', self.id], :order => 'renders.created_at DESC').map { |o| o.song_okey }
- song_library = commercial? ? API::Song::commercial_library : API::Song::consumer_library
- history = []
- song_okeys.each do |okey|
- # Library consists of an array of arrays
- song_library.each do |i|
- i.each do |j|
- history << j if j.id == okey
- end
- end
- end
- history
- end
Add Comment
Please, Sign In to add comment