Skip to content

Instantly share code, notes, and snippets.

View peteygao's full-sized avatar
💭
Writing Elm @ Selph.ai

Peter Gao peteygao

💭
Writing Elm @ Selph.ai
View GitHub Profile
@peteygao
peteygao / gist:4177597
Created November 30, 2012 18:30
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