Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (10 sloc) 280 Bytes
require 'recommender'
class Playlist < ActiveRecord::Base
has_many :tracks
def as_json(*options)
{ id: id, tracks: tracks.map(&:as_json) }
end
def self.build_from_artists(artists)
Playlist.new tracks: Recommender.recommend_tracks_from_artists(artists)
end
end