Skip to content

Commit

Permalink
Rescue from shipping error in orders controllers.
Browse files Browse the repository at this point in the history
Shipping price may be calculated when adding products to order if user is logged & address is filled.
  • Loading branch information
j15e committed Oct 4, 2012
1 parent e797dc2 commit 0a032f5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/controllers/spree/orders_controller_decorator.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
# handle shipping errors gracefully during order update
Spree::OrdersController.class_eval do

rescue_from Spree::ShippingError, :with => :handle_shipping_error

private
def handle_shipping_error(e)
flash[:error] = e.message
redirect_back_or_default(root_path)
end
end

0 comments on commit 0a032f5

Please sign in to comment.