Files
mozo-backend/app/serializers/users/product_serializer.rb
T
2015-09-05 14:14:28 +02:00

15 lines
371 B
Ruby

class Users::ProductSerializer
include Qwaiter::UserBaseSerializer
attributes :name, :price, :description, :image, :code, :position, :visible, :active, :product_category_id
has_many :product_variants, serializer: Users::ProductVariantSerializer
def image
if object.image.present?
{small: object.image.url(:small)}
else
nil
end
end
end