Hi you all,
I''m working with a legacy database that has:
User:
- id: primary key.
- dirip: IP address.
Bugs:
...
-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
right).
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?
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---