1
0
Fork 0
forked from OpenNeo/impress

hopefully raise more descriptive error message when contribution fails to save

This commit is contained in:
Emi Matchu 2011-02-22 18:45:53 -05:00
parent 492841d9bc
commit abb29aae4b

View file

@ -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