Rools with ActiveRecord

25 views
Skip to first unread message

Reno

unread,
Jul 21, 2008, 12:39:48 PM7/21/08
to Rools Users
Hi everybody,

I would like to use Rools with ActiveRecord class. Does someone has
any experience with both of them ? I've tried to implement in a method
but it return an error:

/Library/Ruby/Gems/1.8/gems/rools-0.4/lib/rools/
default_parameter_proc.rb:56:in `method_missing': symbol: inspect not
found in facts (Exception)

Thank you for your suggestion,


Pat Cappelaere

unread,
Jul 21, 2008, 5:06:01 PM7/21/08
to rools...@googlegroups.com
Reno,

Try to make the following patch and let me know if this solves your problem:
In that same file:
/Library/Ruby/Gems/1.8/gems/rools-0.4/lib/rools/default_parameter_proc.rb

def method_missing(sym, *args)
# puts "method missing: #{sym} args:#{args.inspect}"
# check if it is a fact first
# begin
facts = @rule.rule_set.get_facts
if facts.has_key?( sym.to_s )
#puts "return fact #{facts[sym.to_s].value}"
return facts[sym.to_s].value
else
if sym.to_s != "inspect"
raise Exception, "symbol: #{sym.to_s} not found in facts"
else
return nil
end
end
#rescue Exception => e
# puts "miss exception #{e} #{e.backtrace.join("\n")}"
# return nil
#end
end

Regards,
Pat.

Reply all
Reply to author
Forward
0 new messages