Sha256: dba43dba2d68df29f047868aee4001a6d96e3738d9573754a8f0a868d55f51fb

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

class Unico::CreditorRepresentative < Unico::Model
  self.abstract_class = true
  self.table_name = :unico_creditor_representatives

  belongs_to :creditor, class_name: '::Creditor'
  belongs_to :representative_person, class_name: '::Person'

  delegate :name, :identity_document, :phone, :email, :identity_number, :to_s,
           to: :representative_person, allow_nil: true

  orderize :id

  def self.term(q)
    person_table = ::Person.arel_table

    joins(:representative_person)
      .where(person_table[:name].matches("#{q}%"))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 app/models/unico/creditor_representative.rb