Hi you all,
I’m working with a legacy database that has:
- id: primary key.
- dirip: IP address.
-dirip: IP address (foreign key referring to User)
A user can have generated many bugs, and a bug belongs to one user.
However, as you can see, Bugs.dirip refers to User.dirip, not User.id
(cause dirip is also unique, and the db creators thought this would be
So, in the belongs_to declaration in Bugs, I can change the foreign_key
namebut… how can I say that this foreign key is not referring to
User.id in the belongs_to declaration???
If I can’t change that, I have to override the user.bugs method and
bug.user method, implementing mine, am I right?