title: Generate model in Rails using user_id:integer vs user:references
body: <p>I'm confused on how to generate a model that belongs_to another model. My book uses this syntax to associate Micropost with User:</p>
  <pre><code>rails generate model Micropost user_id:integer
  </code></pre>
  <p>but <a href="https://guides.rubyonrails.org/active_record_migrations.html#creating-a-standalone-migration" rel="noreferrer">https://guides.rubyonrails.org/active_record_migrations.html#creating-a-standalone-migration</a> says to do it like this:</p>
  <pre><code>rails generate model Micropost user:references
  </code></pre>
  <p>The migrations generated by these 2 are different. Also, for the former, how does rails know that <code>user_id</code> is a foreign key referencing <code>user</code>? Thanks!</p>