I’d like to associate two model objects such as
class Pair < ActiveRecord::Base
has_one :good_member, :class_name=>‘Member’
has_one :bad_member, :class_name=>‘Member’
class Member < ActiveRecord::Base
so that a pair has two members where one is good and the other is bad.
As far as I understand, the association information would be kept in
the “member” database table as a foreign key to the associated “pair”
record, e.g. member_id
Since the association information is not kept within the “pair” table
- where it would be possible to distinguish between the good and the
bad member, how can I do the above association?
It would be quite comfortable to declare this kind of relationship in
the style above.
Many thanks in advance,