Forum: Rails Engines How to dynamically buid relationships between models?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
big mac (Guest)
on 2006-05-22 08:14
(Received via mailing list)
Hi Joshua,
This is what you're looking for, it is under the README file of the
engines
plugin:

=== Model/Lib Tweaks
Alas, tweaking model objects isn't quite so easy (yet). If you need to
change the behaviour of model objects, you'll need to copy the model
file
from the engine into <tt>/app/models</tt> and edit the methods yourself.
Library code can be overridden in a similar way.

So basically, you copy the user model file of the user engine over to
your
RAILS_ROOT/app/models directory and add the relationship there.

When your application runs, it will pick up this version of the user
model,
instead of the UserEngine version.

Hope this helps,
Mac



>Hi all

>I'm trapped with the following problem.

>I'd like to work with the UserEngine engine. Every user has let's say a
>Profile model. So they have a 1:1 relationship.

>Now I should declare this relationship in both models. But where do I
>have to declare it exactly in the User model? I see they are working
>somehow with modules in the engine's lib dir, but how does this work
>exactly? I'm quite confused... :-/
This topic is locked and can not be replied to.