app/models/promotion.rb in spree_promo-0.50.0 vs app/models/promotion.rb in spree_promo-0.50.1
- old
+ new
@@ -5,11 +5,11 @@
has_many :promotion_rules, :autosave => true
accepts_nested_attributes_for :promotion_rules
alias_method :rules, :promotion_rules
- validates :name, :code, :presence => true
+ validates :name, :presence => true
# TODO: Remove that after fix for https://rails.lighthouseapp.com/projects/8994/tickets/4329-has_many-through-association-does-not-link-models-on-association-save
# is provided
def save(*)
if super
@@ -18,9 +18,10 @@
end
MATCH_POLICIES = %w(all any)
scope :automatic, where("code IS NULL OR code = ''")
+ scope :manual, where("code IS NOT NULL AND code <> ''")
def eligible?(order)
!expired? && rules_are_eligible?(order)
end