Merge pull request #1546 from consul/no-money-error

Fix no money error
This commit is contained in:
Alberto
2017-05-17 17:36:20 +02:00
committed by GitHub
3 changed files with 26 additions and 6 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
@@ -29,7 +27,6 @@ module Budgets
@line.destroy
load_investments
#@ballot.reset_geozone
end
private

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