Class: LedgerClosingPeriod
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- LedgerClosingPeriod
- Includes:
- Models::Auditable
- Defined in:
- app/models/ledger_closing_period.rb
Overview
== Schema Information
Table name: ledger_closing_periods
Database name: primary
id :integer not null, primary key
close_to :date
companies :string(255) is an Array
transaction_types :string(255) is an Array
created_at :datetime
updated_at :datetime
creator_id :integer
updater_id :integer
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Class Method Summary collapse
-
.company_in_all_or ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are company in all or.
-
.transaction_type_in ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are transaction type in.
-
.transaction_type_in_all_or ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are transaction type in all or.
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.company_in_all_or ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are company in all or. Active Record Scope
24 |
# File 'app/models/ledger_closing_period.rb', line 24 scope :company_in_all_or, ->(company_id) { where("companies && ARRAY[?]::varchar[]", [company_id,"ALL"]) } |
.transaction_type_in ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are transaction type in. Active Record Scope
26 |
# File 'app/models/ledger_closing_period.rb', line 26 scope :transaction_type_in, ->(transaction_type) { where.any(transaction_types: transaction_type) } |
.transaction_type_in_all_or ⇒ ActiveRecord::Relation<LedgerClosingPeriod>
A relation of LedgerClosingPeriods that are transaction type in all or. Active Record Scope
25 |
# File 'app/models/ledger_closing_period.rb', line 25 scope :transaction_type_in_all_or, ->(transaction_type) { where("transaction_types && ARRAY[?]::varchar[]", [transaction_type,"ALL"]) } |
Instance Method Details
#bank_rec_by_itself ⇒ Object
28 29 30 31 32 |
# File 'app/models/ledger_closing_period.rb', line 28 def bank_rec_by_itself if self.transaction_types.present? and self.transaction_types.include?("BANK_REC") and self.transaction_types.length > 1 errors[:transaction_types] << "must contain only BANK_REC if BANK_REC is present." end end |