Module: BudgetDivision::Associations

Defined in:
app/models/budget_division.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



17
18
19
# File 'app/models/budget_division.rb', line 17

def self.included(base)
  base.belongs_to :budget_division, optional: false
end

Instance Method Details

#budget_divisionObject



21
22
23
24
25
# File 'app/models/budget_division.rb', line 21

def budget_division
  # When this is called during initialisation of a Project, it is already set (therefore goes down 'super' route)
  # - due to the database-level default on projects table (budget_division_id = 1)
  super || BudgetDivision.unallocated
end