diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb index e341e07d1..64806f2c9 100644 --- a/app/controllers/budgets/ballot/lines_controller.rb +++ b/app/controllers/budgets/ballot/lines_controller.rb @@ -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 diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index 6a4047aff..83e799d6f 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -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