Skip to content

Instantly share code, notes, and snippets.

@leikind
Created October 13, 2010 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leikind/623802 to your computer and use it in GitHub Desktop.
Save leikind/623802 to your computer and use it in GitHub Desktop.
Myself versus consultants #2
def create
Order.transaction do
ArticlePurchase.transaction do
@order = create_order # can go wrong due to programmers' mistakes
@order.purchase # can go wrong due to programmers' mistakes
flash[:notice] = :order_successfully_created.l
end
end
redirect_to account_root_path
rescue # Intercepting ALL errors, so the user is
# always to blame whichever error was produced!!!
flash[:error] = "You don't have enough points"
redirect_to account_root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment