Player library, unified renderer for artists and playlists

This commit is contained in:
magnolia-fan
2011-11-27 16:37:51 +04:00
parent 453e809646
commit 9ec28708c5
23 changed files with 174 additions and 122 deletions
+8
View File
@@ -2,4 +2,12 @@ class Playlist < ActiveRecord::Base
belongs_to :user
belongs_to :artist
has_many :playlist_items, dependent: :destroy
def serialize
data = {name: name, pic_url: pic_url, tracks: []}
playlist_items.each do |item|
data[:tracks] << item.track.serialize
end
data
end
end