Belongs_to with foreign keys that reference non primary key

Hello,
I have a situation where the foreign key into a table doesn’t
correspond to that table’s primary key:

my_table

id (pk)
name

other_table

id (pk)
my_table_name (fk references my_table(name))

I want to be able to say something like:
class OtherTable < ActiveRecord::Base
belongs_to :my_table, :foreign_key => { :my_table_name => :name }
end

OtherTable.find(:first).my_table

Is this possible? If not, what is the reasoning behind the decision?

Thanks.

On Aug 30, 6:34 pm, “Christopher J. Bottaro” [email protected]
wrote:

other_table
OtherTable.find(:first).my_table

Is this possible? If not, what is the reasoning behind the decision?

Thanks.

Is this possible?