Permalink
Browse files

Updated the coupon code create from list to include the sell threshold.

  • Loading branch information...
1 parent dd88101 commit 04ded9ba8dbdc399469dcf1d0f151fe0c7251516 @mikefarmer mikefarmer committed Jan 24, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 promo/app/models/coupon_code.rb
@@ -22,7 +22,7 @@ def update_adjustment(adjustment, calculable)
# Takes an array or string of coupons and creates the coupons for the
# provided promotion. Made to handle all kinds of crazy formats of the array
# or string
- def self.create_from_list(promo, coupons)
+ def self.create_from_list(promo, coupons, sell_threshold=1)
begin
num_codes_imported = 0
if coupons.is_a? Enumerable
@@ -44,7 +44,8 @@ def self.create_from_list(promo, coupons)
CouponCode.transaction do
coupon_list.each do |code|
promo.coupon_codes.create!({
- :code => code
+ :code => code,
+ :sell_threshold => sell_threshold
})
num_codes_imported += 1
end

0 comments on commit 04ded9b

Please sign in to comment.