jam-cloud/web/app/views/api_jam_tracks/show.rabl

23 lines
567 B
Ruby

object @jam_track
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version
node :genres do |item|
[item.genre.description] # XXX: need to return single genre; not array
end
node :added_cart do |item|
any_user.shopping_carts.where("cart_id='?'",item.id).count != 0
end
node :purchased do |item|
!!item.right_for_user(current_user)
end
child(:jam_track_tracks => :tracks) {
attributes :id, :part, :instrument, :track_type
}
child(:licensor => :licensor) {
attributes :id, :name
}