Class: SpecialOfferRule

Inherits:
Rule
  • Object
show all
Includes:
Ruleby
Defined in:
app/models/special_offer_rule.rb

Instance Method Summary collapse

Instance Method Details

#validate_ruleby_syntaxObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/special_offer_rule.rb', line 6

def validate_ruleby_syntax
  begin
    engine :special_offer_engine do |e|
      rule_builder = SpecialOffer.new(e)
      rule_builder.selected_products = []
      rule_builder.rule_preview(self)
      Product.actives.all(:limit => 100).each do |product|
        e.assert product
      end
      e.match
    end
  rescue Exception
    return false
  end
end