Displaying 1 result from an estimated 1 matches for "other_company_id".
2008 Jan 21
13
has_many with different primary key
...p would be
appreciated.
In my current project Companies can have many reviews.
class Company < ActiveRecord::Base
has_many :reviews, :as => :reviewable
end
However, my company table, I have two different IDs to identify my
company.
id - This is the typical id we use for normal stuff
other_company_id - This is the id we use for reviews (on a shared db)
Don''t ask why, we''re integrating two systems. So, rather then using id
as the primary key for the relationship (as the above code would do) I
want to use other_company_id for the primary key. It''d be great if I
coul...