Skip to content

Instantly share code, notes, and snippets.

@peteygao
Created November 30, 2012 18:30
Show Gist options
  • Save peteygao/4177597 to your computer and use it in GitHub Desktop.
Save peteygao/4177597 to your computer and use it in GitHub Desktop.
Cleaner way of handling nested exceptions?
# This is ugly... What's a better way?
begin
@beans = beans.find(params[:id])
begin
@beans.destroy
rescue ActiveRecord::StaleObjectError => exception
end
rescue ActiveRecord::RecordNotFound => exception
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment