Files
mozo-backend/app/serializers/product_serializer.rb
T
2015-04-08 09:37:39 +02:00

15 lines
320 B
Ruby

class ProductSerializer < Qwaiter::Serializer
root 'product'
attributes :name, :price, :description, :image, :code, :position, :visible, :active, :product_category_id
has_many :product_variants
def image
if object.image.present?
{small: object.image.url(:small)}
else
nil
end
end
end