# 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