title: Rails Migration: add_reference to Table but Different Column Name For Foreign Key Than Rails Convention
body: <p>I have the following two Models:</p>
  
  <pre><code>class Store &lt; ActiveRecord::Base
      belongs_to :person
  end
  
  class Person &lt; ActiveRecord::Base
      has_one :store
  end
  </code></pre>
  
  <p>Here is the issue: I am trying to create a migration to create the foreign key within the people table. However, the column referring to the foreign key of Store is not named <em>store_id</em> as would be rails convention but is instead named <em>foo_bar_store_id</em>.  </p>
  
  <p>If I was following the rails convention I would do the migration like this:</p>
  
  <pre><code>class AddReferencesToPeople &lt; ActiveRecord::Migration
    def change
      add_reference :people, :store, index: true
    end
  end
  </code></pre>
  
  <p>However this will not work because the column name is not <strong><em>store_id</em></strong> but is <strong><em>foo_bar_store_id</em></strong>.  So how do I specify that the foreign key name is just different, but still maintain index: true to maintain fast performance?</p>