i take the code from the offer_test.rb file and put in
offer_controller.rb
i get error:
rule_0, Anonymous modules have no name to be referenced by
here is offers.csv:
rule-set,Define Offer
parameter,Person
Condition,Consequence
person.personicx == #{personicx},$offer = #{offer}
Personicx,Offer
1,College Student
2,General Consumer
here is offer_controller.rb:
class OfferController < ApplicationController
require 'rools'
require 'uri'
class Person
attr_accessor :name, :personicx
def initialize(name, personicx)
@name = name
@personicx = personicx
end
end
def index
a = "/store/show_by_tags/"
sally = Person.new("sally", 1)
peggy = Person.new("peggy", 2)
rules = Rools::RuleSet.new "/rails/purl/businessrules/offers.csv"
rules.assert sally
a += $offer
a = URI.escape(a)
redirect_to a
end
end