JSON api serializers for suppliers

This commit is contained in:
2015-09-09 19:11:46 +02:00
parent 5cdbe57dec
commit 968d042501
37 changed files with 86 additions and 133 deletions
@@ -1,6 +1,6 @@
class Suppliers::ProductSerializer
include Qwaiter::SupplierBaseSerializer
attributes :name, :price, :description, :code, :position, :visible, :active, :product_category_id
attributes :name, :price, :description, :code, :position, :visible, :active
attribute :image do
if object.image.present?
{small: object.image.url(:small)}
@@ -10,4 +10,5 @@ class Suppliers::ProductSerializer
end
has_many :product_variants, serializer: Suppliers::ProductVariantSerializer
has_one :product_category, serializer: Suppliers::ProductSerializer
end