16 lines
460 B
Ruby
16 lines
460 B
Ruby
class Suppliers::ProductSerializer
|
|
include Mozo::SupplierBaseSerializer
|
|
|
|
attributes :name, :price, :description, :code, :position, :visible, :active
|
|
attribute :image do
|
|
if object.image.present?
|
|
{small: object.image.url(:small)}
|
|
else
|
|
{small: object.image.url}
|
|
end
|
|
end
|
|
|
|
has_many :product_variants, serializer: Suppliers::ProductVariantSerializer
|
|
has_one :product_category, serializer: Suppliers::ProductCategorySerializer
|
|
end
|