Hi all, I'm trying to write a plugin which will allow me to specify: acts_as_item :option=>:value
i need to be able to access the :options=>:value hash from instances of the model also. I've tried with class_eval in the plugin, but can't get it working. I'm calling acts_as_item(options), and that method can see the options passed from a model. Then inside the class_eval, I'm adding a method (def self.configuration) which returns the options hash. I thought from an instance, I'd be able to do instance.class.configuration which would then return said options hash. Any ideas? thanks for reading. module Item #called by active record for us def self.included(base) base.extend ClassMethods end module ClassMethods def acts_as_item(options = {}) configuration = {:option=>:value} class_eval { include InstanceMethods def self.configuration puts "in def acts_as_item (#{configuration})\n\n" end } end end module InstanceMethods def item_name puts self.class.configuration end end end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.