Zack Ham
2006-May-31 00:48 UTC
[Rails] belongs_to without referencing an id as a foreign key?
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060531/f8ea42d7/attachment.html