Jens,
that works!
I created this module and put that in a ruby file in the lib folder
under my rails app,
module MyModule
module Accessor
module ClassMethods
def mm_proxy_accessor(object, attributes)
attributes.each do |v|
define_method( v.to_sym ) do
obj = self.send(object)
if(obj.nil?)
return nil
else
obj.send v.to_s
end
end
end
end
end
def self.included(base)
base.extend(ClassMethods)
end
end
end
Then I include it in my User model.
but Ruby complains with this error:
NameError: uninitialized constant User::MyModule
if I put the module definition in my User.rb file, it works fine.
what am I doing wrong?
Thanks.
Yaxm
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk