# ActiveRecord naming help

**URL:** <https://www.ruby-forum.com/t/activerecord-naming-help/103965>\
**Category:** Rails\
**Created:** [May 12, 2007, 1:49am UTC](https://www.ruby-forum.com/t/activerecord-naming-help/103965 "2007-05-12T01:49:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 12, 2007, 1:49am UTC](https://www.ruby-forum.com/t/activerecord-naming-help/103965/1 "2007-05-12T01:49:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 12, 2007, 2:58am UTC](https://www.ruby-forum.com/t/activerecord-naming-help/103965/2 "2007-05-12T02:58:45Z")

</div>

class Incident \< ActiveRecord::Base  
belongs\_to :victim, :class\_name =\>  
“Pilot”, :foreign\_key=\>“victim\_id”  
belongs\_to :attacker, :class\_name =\>  
“Pilot”, :foreign\_key=\>“attacker\_id”  
end
