Files
openfoodnetwork/app/views/admin/enterprises/index.rabl
2014-06-03 12:18:27 +10:00

15 lines
416 B
Ruby

collection @collection
attributes :id, :name
child supplied_products: :supplied_products do |product|
attributes :name
node(:supplier_name) { |p| p.supplier.andand.name }
node(:image_url) { |p| p.images.present? ? p.images.first.attachment.url(:mini) : nil }
node(:master_id) { |p| p.master.id }
child variants: :variants do |variant|
attributes :id
node(:label) { |v| v.options_text }
end
end