This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 module Spree | |
ItemAdjustments.class_eval do | |
2 | |
3 # Picks one (and only one) promotion to be eligible for this order | |
4 # This promotion provides the most discount, and if two promotions | |
5 # have the same amount, then it will pick the latest one. | |
6 def choose_best_promotion_adjustment | |
7 raise "#{adjustment}" | |
8 if best_promotion_adjustment | |
9 other_promotions = self.adjustments.promotion.where.not(id: best_promotion_adjustment.id) |