Sha256: 563fe754a1448e5c568fd7fc8dceab816e52284aab1790000f454b09bf42a509
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
class Unico::CreditorDocument < Unico::Model extend EnumerateIt self.abstract_class = true has_enumeration_for :issuer belongs_to :creditor, class_name: '::Creditor' belongs_to :document_type, class_name: '::DocumentType' delegate :description, to: :document_type, allow_nil: true validates :document_type, :document_number, :emission_date, :validity, :issuer, presence: true validates :emission_date, timeliness: { on_or_before: :today, type: :date, on_or_before_message: :should_be_on_or_before_today }, allow_blank: true validates :validity, timeliness: { on_or_after: :emission_date, type: :date, on_or_after_message: :validity_should_be_on_or_after_emission_date }, allow_blank: true def self.by_habilitation_kind(kind) joins(:document_type) .where(DocumentType.arel_table[:habilitation_kind].eq kind) end def to_s document_type end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unico-training-7.8.0 | app/models/unico/creditor_document.rb |