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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
1d623696d26ebebafecb8a2a2bc0f32e?d=identicon&s=25 big mac (Guest)
on 2006-05-22 06:14
(Received via mailing list)
Hi Joshua,
This is what you're looking for, it is under the README file of the

=== 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
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
RAILS_ROOT/app/models directory and add the relationship there.

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

Hope this helps,

>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.