Forum: Ruby on Rails belongs_to without referencing an id as a foreign key?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Zack H. (Guest)
on 2006-05-31 04:50
(Received via mailing list)
Hello everyone,

Here's my problem for the day:  I have three tables that look a little
like
the following

table_a
 id

table_b
 id
 position
 table_a_id
 name

table_c
 id
 table_a_id
 table_b_position


There will be many rows in table_c that have the same table_a_id, and
the
same table_b_position.  These will all be referencing the same name
value in
table_b.  The row in table_b may or may not exist, and table_b_position
is a
meaningful field with or without a corresponding row in table_b, so
these
two reasons keep me from using table_b_id within table_c.  The natural
relationship here is for table_c to belong_to table_b, but I do not know
how
to do this.  Any ideas?

Thanks!
Zack
This topic is locked and can not be replied to.