forked from OpenNeo/impress
hopefully raise more descriptive error message when contribution fails to save
This commit is contained in:
parent
492841d9bc
commit
abb29aae4b
1 changed files with 7 additions and 1 deletions
|
@ -23,7 +23,13 @@ class User < ActiveRecord::Base
|
||||||
self.points += new_points
|
self.points += new_points
|
||||||
Pet.transaction do
|
Pet.transaction do
|
||||||
pet.save!
|
pet.save!
|
||||||
new_contributions.each(&:save!)
|
new_contributions.each do |contribution|
|
||||||
|
begin
|
||||||
|
contribution.save!
|
||||||
|
rescue ActiveRecord::RecordNotSaved => e
|
||||||
|
raise ActiveRecord::RecordNotSaved, "#{e.message}, #{contribution.inspect}, #{contribution.valid?.inspect}, #{contribution.errors.inspect}"
|
||||||
|
end
|
||||||
|
end
|
||||||
save!
|
save!
|
||||||
end
|
end
|
||||||
new_points
|
new_points
|
||||||
|
|
Loading…
Reference in a new issue