Skip to content
Browse files

Copy master volume prices when cloning product.

  • Loading branch information...
1 parent b0d93b5 commit cded7f282034596e1514c02713309d3802344390 @amw amw committed Feb 27, 2011
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

0 comments on commit cded7f2

Please sign in to comment.
Something went wrong with that request. Please try again.