Created
October 17, 2012 18:53
-
-
Save mikesjewett/3907373 to your computer and use it in GitHub Desktop.
Error Handling for Meatup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rollback_packages | |
self.lines.each do |l| | |
l.packages each do |p| | |
puts "INside the nested deal" | |
begin | |
ActiveRecord::Base.transaction do | |
p.update_attributes(:sold => false, :line_id => nil) | |
end | |
rescue => e | |
self.errors[:base] << e.message | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment