add column name in serializer in object

 module BxBlockApprover

  class ApproverSerializer < BuilderBase::BaseSerializer

    include FastJsonapi::ObjectSerializer

    attributes *[

      :id,

      :no_of_approvers,

      :approver_account_ids,

      :description,

      :notify,

      :role_id,

      :account_id

    ] 


    attribute :role do |object|

      object&.role&.name

    end

    

  end

end


Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5