title: Creating a migration for a model with multiple associations
body: <p>I'm a bit confused about how I would go about creating a migration for a model with multiple associations to the same table.</p>
  
  <pre><code>class Kill &lt; ActiveRecord::Base
    belongs_to :player, :class_name =&gt; 'Player'
    belongs_to :killed, :class_name =&gt; 'Player'
  end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Player &lt; ActiveRecord::Base
    belongs_to :team
    has_many :kills, :class_name =&gt; 'Kill', :foreign_key =&gt; 'kills_id'
    has_many :killed_by, :class_name =&gt; 'Kill', :foreign_key =&gt; 'killed_by_id'
  end
  </code></pre>
  
  <p>Is this setup right? I want to create a migration for this but I have been using</p>
  
  <pre><code>rails g migration Player kill:reference killed_by:reference
  </code></pre>
  
  <p>in the past for similar things, but it seems like since <code>kill</code> isn't a direct reference to the class name it does not work. How should I be creating the migration for this?</p>