Question about belongs_to


#1

Hello guys,

I am trying to create a belongs_to relation between 2 tables.

table users
id
login
.

table apps
id
admin
.
.

I need to create a belongs_to relation on the App model. The admin
column in apps references the user login. I will have used user_id
instead of the login name but I can’t change this right now (so they
said), so I have to try to make the relationship as it is. I did the
following but I don’t know how to put that admin should reference the
User login column:

belongs_to :owner, :class_name = “User”, :foreign_key => “admin”

Help please any,

Elías


#2

On 18 Feb 2009, at 15:56, elioncho wrote:

table apps
User login column:

belongs_to :owner, :class_name = “User”, :foreign_key => “admin”

ActiveRecord doesn’t support that.

Fred