blob: 09310a004a39c46f8d2d8ab7c22e3869f32714a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# frozen_string_literal: true
module Serializers
# ProductSerializer
class ProductSerializer < BaseSerializer
extend ActionView::RoutingUrlFor
attributes :name, :unitary_price, :bulk_price, :available_quantity, :categories, :company
attribute :picture do |object|
object.picture.url
end
attribute :company do |object|
{ name: object.company.name, short_name: object.company.short_name }
end
end
end
|