Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Copy master volume prices when cloning product.

  • Loading branch information...
commit cded7f282034596e1514c02713309d3802344390 1 parent b0d93b5
@amw amw authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 app/models/product_decorator.rb
View
7 app/models/product_decorator.rb
@@ -5,4 +5,11 @@ def save_master
return unless master && (master.changed? || master.new_record? || master.changed_for_autosave?)
raise ActiveRecord::Rollback unless master.save
end
+
+ private
+ def duplicate_extra original
+ self.master.volume_prices = original.master.volume_prices.map do |vp|
+ VolumePrice.new vp.attributes.slice('starting_quantity', 'price')
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.