jam-cloud/app/views/api_bands/show.rabl

24 lines
625 B
Ruby

object @band
attributes :id, :name, :website, :biography, :photo_url, :logo_url
unless @band.users.nil? || @band.users.size == 0
child :users => :musicians do
attributes :id, :name, :photo_url
# TODO: figure out how to omit empty arrays
node :instruments do |user|
unless user.instruments.nil? || user.instruments.size == 0
child :musician_instruments => :instruments do
attributes :id, :description, :proficiency_level
end
end
end
end
end
unless @band.genres.nil? || @band.genres.size == 0
child :genres => :genres do
attributes :id, :description
end
end