diff options
Diffstat (limited to 'app/controllers/serializers')
-rw-r--r-- | app/controllers/serializers/product_serializer.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/controllers/serializers/product_serializer.rb b/app/controllers/serializers/product_serializer.rb index 4a2158d..09310a0 100644 --- a/app/controllers/serializers/product_serializer.rb +++ b/app/controllers/serializers/product_serializer.rb @@ -5,17 +5,14 @@ module Serializers class ProductSerializer < BaseSerializer extend ActionView::RoutingUrlFor - attributes :name, :unitary_price, :bulk_price, :available_quantity, :categories + attributes :name, :unitary_price, :bulk_price, :available_quantity, :categories, :company attribute :picture do |object| object.picture.url end - belongs_to :company, links: { - self: :url, - related: lambda(object) { - company_path(object.company) - } - } + attribute :company do |object| + { name: object.company.name, short_name: object.company.short_name } + end end end
\ No newline at end of file |