title: Activerecord migrations, making t.references correctly point to a custom ID type, string not integer?
body: <p>Below I have a migration for the "test" model which uses it's own primary key, a String instead of an Integer.</p>
  
  <pre><code>    class CreateTest &lt; ActiveRecord::Migration[5.1]
        def change
          create_table :test, id: false do |t|
  
            t.string  :id,          primary_key: true
  
            t.timestamps
          end        
        end
      end
  </code></pre>
  
  <p>Now we have the "client" model that <code>t.references</code> test.</p>
  
  <pre><code>    class CreateClients &lt; ActiveRecord::Migration[5.1]
        def change
          create_table :clients do |t|
  
            t.references :test,   null: false
  
            t.timestamps
          end
        end
      end
  </code></pre>
  
  <p>The issue is that <code>t.references</code> assumes it's an integer id.</p>
  
  <pre><code>    # == Schema Information
      #
      # Table name: clients
      #
      #  id         :integer          not null, primary key
      #  test_id    :integer          not null
      #  created_at :datetime         not null
      #  updated_at :datetime         not null
  </code></pre>
  
  <p>This is obviously wrong as <code>Test.id</code> is a string.</p>
  
  <p>Is there some magic I need to do to have the <code>t.references</code> "know" that it's a string based on the model or something?</p>
  
  <p>Thanks.</p>