# frozen_string_literal: true module Serializers # ProductSerializer class ProductSerializer < BaseSerializer extend ActionView::RoutingUrlFor attributes :name, :unitary_price, :bulk_price, :available_quantity, :categories attribute :picture do |object| object.picture.url end belongs_to :company, links: { self: :url, related: lambda(object) { company_path(object.company) } } end end