Customizing belongs_to method

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.

One way might be to declare dirip as the primary key for User. I'd hate to have to do that (use external data for a key), but it's "a way."

///ark