I have two models
class User
has_many :disputes
end
class Dispute
belongs_to :user
end
So Dispute has :user_id
, but my problem is that a Dispute has 2 sides - the claimant and the indicted, both of which are users.
I tried to solve this problem by creating two columns: :claimant_id
and :indicted_id
, and passing arguments like @dispute.claimant_id = current_user.id
, but after that I can't use a relationship tricks like @dispute.user.name
or @user.disputes
with my :claimant_id
and :indicted_id
.
Is there any way to set up two :user_id (like a claimant and an indicted) in one model and still maintain the relationships between Dispute and User models?