mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-21 00:47:26 +00:00
Fix api admin serializers
This commit is contained in:
@@ -7,8 +7,6 @@ module Api
|
||||
:inherits_properties, :on_hand, :price, :import_date, :image_url,
|
||||
:thumb_url, :variants
|
||||
|
||||
has_one :supplier, key: :producer_id, embed: :id
|
||||
|
||||
def variants
|
||||
ActiveModel::ArraySerializer.new(
|
||||
object.variants,
|
||||
|
||||
@@ -9,6 +9,7 @@ module Api
|
||||
:price, :on_demand, :on_hand, :in_stock, :stock_location_id, :stock_location_name
|
||||
|
||||
has_one :primary_taxon, key: :category_id, embed: :id
|
||||
has_one :supplier, key: :producer_id, embed: :id
|
||||
|
||||
def name
|
||||
if object.full_name.present?
|
||||
@@ -31,7 +32,7 @@ module Api
|
||||
end
|
||||
|
||||
def producer_name
|
||||
object.product.supplier.name
|
||||
object.supplier.name
|
||||
end
|
||||
|
||||
def image
|
||||
|
||||
Reference in New Issue
Block a user