How to set foreign key in Rails
<p>I Have a model named employee. The following is my migration file.</p>

<pre><code>class CreateEmployees &lt; ActiveRecord::Migration
    def change
        create_table :employees, id: false do |t|
            t.string :name
            t.string :password
            t.string :role
            t.primary_key :name
        end
    end
end
</code></pre>

<p>Now, I want to create a model named "teamplayer" with the columns as 'name' which needs to refers 'name' column in employee model. And 'tl' column
which is independent to this model. The following is my "teamplayer" migration file.</p>

<pre><code>class CreateTeamplayers &lt; ActiveRecord::Migration
    def change
        create_table :teamplayers, :id false do |t|
            t.string :tl
            t.string :name
        end
    end
end
</code></pre>

<p>In the above file, how to reference 'name' column to the model employee? So how to achieve foreign key in rails. </p>