Class: Budget

Inherits:
ApplicationRecord show all
Defined in:
app/models/budget.rb

Overview

A certain amount of money (in a given currency) to spend in a group of events

A budget object can represent a periodic budget (like 'money to spend in Q2 of year 2013'), specific budgets for a givent event or any other amount of money. Budgets are defined for a specific currency and needs to be explicity associated to a group of events. If an event is associated to several budgets with the same currency, the amounts are added.

Instance Attribute Summary collapse

Has many collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes

Instance Attribute Details

#amountDecimal

Returns:

  • (Decimal)

Validations:



16
# File 'app/models/budget.rb', line 16

validates :name, :amount, :currency, presence: true

#created_atDateTime

Returns:

  • (DateTime)


57
# File 'db/schema.rb', line 57

t.datetime "created_at"

#currencyString

Returns:

  • (String)

Validations:



16
# File 'app/models/budget.rb', line 16

validates :name, :amount, :currency, presence: true

#descriptionString

Returns:

  • (String)


54
# File 'db/schema.rb', line 54

t.string "description"

#nameString

Returns:

  • (String)

Validations:



16
# File 'app/models/budget.rb', line 16

validates :name, :amount, :currency, presence: true

#updated_atDateTime

Returns:

  • (DateTime)


58
# File 'db/schema.rb', line 58

t.datetime "updated_at"

Instance Method Details

#eventsActiveRecord::Relation<Event>

Events that are covered by the budget

Returns:

  • (ActiveRecord::Relation<Event>)

See Also:



14
# File 'app/models/budget.rb', line 14

has_many :events