Skip to content

Instantly share code, notes, and snippets.

@mikesjewett
Created October 17, 2012 18:53
Show Gist options
  • Save mikesjewett/3907373 to your computer and use it in GitHub Desktop.
Save mikesjewett/3907373 to your computer and use it in GitHub Desktop.
Error Handling for Meatup
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