Skip to content

Instantly share code, notes, and snippets.

@leikind
Created Oct 13, 2010
Embed
What would you like to do?
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