title: Rails belongs_to and has_many is not creating a primary foreign key relation
body: <p>I am creating a primary -> foreign key relationship among my columns while doing the db design. my db design should be:</p>
  
  <p>Users table: userid (primary key), name</p>
  
  <p>Shoppinglist table: shoppingid (primary key), userid(foreign key)</p>
  
  <p>Here is my migration file:</p>
  
  <pre><code>class CreateUsers &lt; ActiveRecord::Migration
    def change
      create_table :users do |t|
        t.integer :userid, :primary_key
        has_many :shoppinglists, dependent: :destroy
  
        t.timestamps null: false
      end
    end
  end
  
  class CreateShoppinglists &lt; ActiveRecord::Migration
    def change
      create_table :shoppinglists do |t|
        t.integer :shoppingid, :primary_key
        t.belongs_to :userid
  
        t.timestamps null: false
      end
    end
  end
  </code></pre>
  
  <p>Isnt there a way to create the above while creating the table instead of creating a new migration file? </p>
  
  <p>I use this command to check my relationships and I dont see any relations created:</p>
  
  <pre><code>User.reflect_on_all_associations
  </code></pre>