Permalink
Browse files

Don't refresh line_items with unsaved changes.

  • Loading branch information...
1 parent 7436dd1 commit a538bd6f579d241f0742dd09d8b7db5052f446f5 Adam Wróbel committed Apr 12, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 app/models/order_decorator.rb
@@ -19,8 +19,10 @@ def variants_starting_quantity *variant_ids
end
def update_totals_with_volume_discount
- # we need to refresh the items
- line_items true
+ # we might need to refresh the items
+ if @line_items && !@line_items.any? {|i| !i.destroyed? && i.changed?}
+ line_items true
+ end
update_totals_without_volume_discount
end
alias_method_chain :update_totals, :volume_discount

0 comments on commit a538bd6

Please sign in to comment.