removes exception on invalid vote
responds rendering correct error message instead
This commit is contained in:
@@ -18,9 +18,7 @@ module Budgets
|
|||||||
load_investment
|
load_investment
|
||||||
load_heading
|
load_heading
|
||||||
|
|
||||||
unless @ballot.add_investment(@investment)
|
@ballot.add_investment(@investment)
|
||||||
head :bad_request
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Budget
|
|||||||
has_many :headings, -> { uniq }, through: :groups
|
has_many :headings, -> { uniq }, through: :groups
|
||||||
|
|
||||||
def add_investment(investment)
|
def add_investment(investment)
|
||||||
lines.create!(investment: investment)
|
lines.create(investment: investment).persisted?
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_amount_spent
|
def total_amount_spent
|
||||||
|
|||||||
Reference in New Issue
Block a user