removes exception on invalid vote

responds rendering correct error message instead
This commit is contained in:
Juanjo Bazán
2017-05-16 13:12:32 +02:00
parent 755248fb12
commit 3eb22ab7b9
2 changed files with 2 additions and 4 deletions

View File

@@ -18,9 +18,7 @@ module Budgets
load_investment
load_heading
unless @ballot.add_investment(@investment)
head :bad_request
end
@ballot.add_investment(@investment)
end
def destroy

View File

@@ -9,7 +9,7 @@ class Budget
has_many :headings, -> { uniq }, through: :groups
def add_investment(investment)
lines.create!(investment: investment)
lines.create(investment: investment).persisted?
end
def total_amount_spent