I know I''m missing something basic, but I need help understanding
something:
I have a model (User) sitting in a component. I want to extend that
model from my app. I need to add in a has_many relationship and a
couple of methods.
I was able to mixin the methods using this:
module MyUser
def my_new_method
# etc
end
end
User.send(:include, MyUser::Acts::Chicken)
This just mixes in the new method. But if I add a ''has_many'',
I get
an error.
I''ve tried using the way to extend ActiveRecord (like in a plugin),
but that''s not working either.
module MyUser
def self.append_features(base)
super
base.extend(ClassMethods)
end
module ClassMethods
def my_new_method
end
end
end
User.send(:include, MyUser)
I''m not understanding the basics of extending a class, not just
mixing things in. Any pointers on this?
Thanks,
Brett