Frederick Cheung wrote:
> I think you need to post more of your code.
Sure:
module MyModule
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def money_is(field_name)
write_inheritable_attribute :some_field, 'value'
class_inheritable_reader :some_field
self.send(:include, MyModule::InstanceMethods)
end
end
module InstanceMethods
define_method "#{self.some_field}" do
# code
end
end
end
> script/console
Loading development environment (Rails 2.1.0)
/home/vidmantas/projects/my_project/vendor/plugins/my_module/lib/my_module.rb:16:NoMethodError:
undefined method `some_field' for MyModule::InstanceMethods:Module
--
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---