Class: Analytic::BudgetDimension

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/analytic/budget_dimension.rb

Overview

== Schema Information

Table name: analytic_budget_dimensions
Database name: primary

id :integer not null, primary key
account_description :string
children_count :integer
description :string
ledger_account_ids :string default([]), is an Array
ledger_company_account_ids :text default([]), is an Array
created_at :datetime not null
updated_at :datetime not null
budget_group_id :integer
business_unit_id :integer
company_id :string
ledger_account_id :integer
ledger_project_id :integer
parent_id :integer
supplier_id :integer

Indexes

by_cid_laid_bgid_w (company_id,ledger_account_ids,budget_group_id) WHERE ((business_unit_id IS NULL) AND (ledger_project_id IS NULL) AND (supplier_id IS NULL) AND (parent_id IS NULL))
by_cid_laid_buid_lpid_bgid_pid_w (company_id,ledger_account_ids,business_unit_id,ledger_project_id,budget_group_id,parent_id) WHERE (supplier_id IS NULL)
idx_budget_dimensions_company_account_bu_project_supplier (company_id,ledger_account_id,business_unit_id,ledger_project_id,supplier_id)
index_analytic_budget_dimensions_on_parent_id (parent_id)

Has many collapse

Class Method Summary collapse

Class Method Details

.find_or_create_with(existing_attrs, new_attrs) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'app/models/analytic/budget_dimension.rb', line 58

def self.find_or_create_with(existing_attrs, new_attrs)
  bd = self.where(existing_attrs).first
  if bd.nil?
    bd = self.create!(existing_attrs.merge(new_attrs))
  else
    bd.update!(new_attrs)
  end
  bd
end

Instance Method Details

#budget_factsActiveRecord::Relation<BudgetFact>

Returns:

See Also:



36
# File 'app/models/analytic/budget_dimension.rb', line 36

has_many :budget_facts