Class: LedgerProject
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- LedgerProject
- Includes:
- Models::Auditable, Models::Lineage
- Defined in:
- app/models/ledger_project.rb
Overview
== Schema Information
Table name: ledger_projects
Database name: primary
id :integer not null, primary key
description :string(255) not null
project_number :integer not null
type :string(255)
created_at :datetime
updated_at :datetime
creator_id :integer
parent_id :integer
updater_id :integer
Indexes
idx_ledger_projects_where_id (type) WHERE (id IS NULL)
index_ledger_projects_on_type (type)
project_number_type (project_number,type)
Direct Known Subclasses
Constant Summary collapse
- PROJECT_TYPES =
{ "Detail" => "LedgerDetailProject", "Summary" => "LedgerSummaryProject"}.freeze
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
-
#do_not_set_project_number ⇒ Object
Returns the value of attribute do_not_set_project_number.
Has many collapse
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater
Methods included from Models::Lineage
#ancestors, #ancestors_ids, #children_and_roots, #descendants, #descendants_ids, #ensure_non_recursive_lineage, #family_members, #generate_full_name, #generate_full_name_array, #lineage, #lineage_array, #lineage_simple, #root, #root_id, #self_ancestors_and_descendants, #self_ancestors_and_descendants_ids, #self_and_ancestors, #self_and_ancestors_ids, #self_and_children, #self_and_descendants, #self_and_descendants_ids, #self_and_siblings, #self_and_siblings_ids, #siblings, #siblings_ids
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#do_not_set_project_number ⇒ Object
Returns the value of attribute do_not_set_project_number.
30 31 32 |
# File 'app/models/ledger_project.rb', line 30 def do_not_set_project_number @do_not_set_project_number end |
Class Method Details
.is_valid_type?(project_type) ⇒ Boolean
53 54 55 |
# File 'app/models/ledger_project.rb', line 53 def self.is_valid_type?(project_type) PROJECT_TYPES.values.include?project_type end |
.select_options ⇒ Object
44 45 46 47 |
# File 'app/models/ledger_project.rb', line 44 def self. # LedgerProject.all.order(:project_number).pluck("concat(project_number, ' ', description)", "id") LedgerProject.all.order(:project_number).map{ |lp| [lp.name_for_select, lp.id]} end |
.types_for_select ⇒ Object
49 50 51 |
# File 'app/models/ledger_project.rb', line 49 def self.types_for_select PROJECT_TYPES.map{|k,v| [k,v]} end |
Instance Method Details
#budgets ⇒ ActiveRecord::Relation<Budget>
26 |
# File 'app/models/ledger_project.rb', line 26 has_many :budgets |
#name_for_select ⇒ Object
57 58 59 |
# File 'app/models/ledger_project.rb', line 57 def name_for_select "#{project_number} #{description}" end |
#summary_name ⇒ Object
40 41 42 |
# File 'app/models/ledger_project.rb', line 40 def summary_name "#{project_number} #{description}" end |