hi again, all. I have the following plugin included in my active record model. What i'd like to do, is define a method inside class_eval which returns the options has that was passed into it via the acts_as_item :foo=>:bar in my model.
What i'm finding odd is that the self.foo method can access the config hash when printing it, but not when i try to return it.
puts "OK FOO: #{config[:asset_root]}" - outputs ok, whereas the return config raises a method or variable not found error.
Any ideas? best, paul.
module ClassMethods def acts_as_item(options = {}) include InstanceMethods
config = {:asset_root=>"SOMEPATH"} config.update(options) if options.is_a?(Hash)
class_eval <<-EOE def self.foo puts "OK FOO: #{config[:asset_root]}" return config end EOE end end