title: has_many association migration in Rails
body: <p>I m working on a Rails project (Rails version 4.2.3). 
  I created a <code>User</code> and <code>Task</code> model but did not include any association between them during creation. 
  Now i want one <code>user</code>  to have many <code>tasks</code> and one <code>task</code> belonging to one <code>user</code>. </p>
  
  <p>Through <code>rails g migration AddUserToTask user:belongs_to</code> from <a href="https://stackoverflow.com/questions/17894688/has-many-belongs-to-relation-in-active-record-migration-rails-4">this thread</a>
  i was able to insert the foreign user_id key in the tasks table. But how to i add a the <code>has_many</code> migration? I updated the <code>User</code> model: </p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :customers
  end 
  </code></pre>
  
  <p>but i m not sure how i have to write the migration. So far i wrote this:</p>
  
  <pre><code>class addTasksToUser &lt; ActiveRecords::Migration
    def change
      update_table :users do |t|
        t.has_many :tasks
      end 
      add_index :users, taks_id
    end
  end 
  </code></pre>
  
  <p>But <code>rake db:migrate</code> is not performing any action. Is this the correct way to setup the <code>has_many</code> relationship?</p>