Displaying 1 result from an estimated 1 matches for "support_phone_num".
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
...g after_initialize() and instance_eval(), like this:
def after_initialize
self.instance_eval(File.read(''customers/default.rb''))
end
(Ultimately the file path will be dynamic, this is just proof of concept.)
default.rb just contains a few method definitions like this one:
def support_phone_num
"1-800-OBITEME"
end
Anyway, this works in the console, after instantiating the object with a
find() it responds to support_phone_num(). However, back in the
controller, I try to save the object in the session and Webrick gives me a
500 error. development.log says:
TypeError (singleto...