Forum: Ruby on Rails ActiveRecord naming help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D9bc5324aa0cf7018f56b7ccd01e32cf?d=identicon&s=25 (Guest)
on 2007-05-12 01:49
(Received via mailing list)
Rails noob needing a direction to turn... I have a table of Pilots,
and a table of Incidents, each incident has two Pilots associated, one
is a victim and one is the attacker.  I'd like to have my Incidents
table have a "victim_id" and an "attacker_id" and map both of those to
the Pilot's table, but I'm not quite sure where to look in the doc's
for more info.
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 zdennis (Guest)
on 2007-05-12 02:58
(Received via mailing list)
class Incident < ActiveRecord::Base
   belongs_to :victim, :class_name =>
"Pilot", :foreign_key=>"victim_id"
   belongs_to :attacker, :class_name =>
"Pilot", :foreign_key=>"attacker_id"
This topic is locked and can not be replied to.