adds budgets_helper

This commit is contained in:
Juanjo Bazán
2016-07-29 13:34:11 +02:00
parent 3e892c6e76
commit 9014de2693
2 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
module BudgetsHelper
def budget_phases_select_options
Budget::VALID_PHASES.map { |ph| [ t("budget.phase.#{ph}"), ph ] }
end
def budget_currency_symbol_select_options
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
end
end

View File

@@ -1,7 +1,9 @@
class Budget < ActiveRecord::Base
VALID_PHASES = %W{on_hold accepting selecting balloting finished}
CURRENCY_SYMBOLS = %W{€ $ £ ¥}
validates :name, presence: true
validates :phase, inclusion: { in: VALID_PHASES }
has_many :investments, dependent: :destroy