Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. def song_history
  2. 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 }
  3. song_library = commercial? ? API::Song::commercial_library : API::Song::consumer_library
  4. history = []
  5. song_okeys.each do |okey|
  6. # Library consists of an array of arrays
  7. song_library.each do |i|
  8. i.each do |j|
  9. history << j if j.id == okey
  10. end
  11. end
  12. end
  13. history
  14. end
Add Comment
Please, Sign In to add comment