1
0
Fork 0
oldhaven/app/models/beathaven/playlist.rb

14 lines
302 B
Ruby
Raw Normal View History

2011-06-22 00:05:12 +00:00
class Playlist < ActiveRecord::Base
belongs_to :user
2011-11-26 15:03:33 +00:00
belongs_to :artist
2011-11-26 20:56:09 +00:00
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
2011-06-22 00:05:12 +00:00
end