title: Adding a Model Reference to existing Rails model
body: <p>I'd like to know the "proper" way to approach adding a relation between two <em>existing</em> classes in Rails 3.</p>
  
  <p>Given existing models: Clown &amp; Rabbit</p>
  
  <p>I'd like to add a reference (belongs_to) from Rabbit to Clown. I start by trying to generate a migration: </p>
  
  <pre><code>rails g migration AddClownToRabbits clown:reference
  </code></pre>
  
  <p>which gives me a migration that looks like: </p>
  
  <pre><code>class AddClownToRabbits &lt; ActiveRecord::Migration
    def self.up
      add_column :rabbits, :clown, :reference
    end
  
    def self.down
      remove_column :rabbits, :clown
    end
  end
  </code></pre>
  
  <p>After <code>rake db:migrate</code> on this migration I examine SQLite3's development.db and see a new column: <code>"clown" reference</code></p>
  
  <p>I guess I was expecting a <code>"clown_id" integer</code> column and a migration that looked like:</p>
  
  <pre><code>class AddClownToRabbits &lt; ActiveRecord::Migration
    def self.up
      add_column :rabbits, :clown_id
    end
  
    def self.down
      remove_column :rabbits, :clown_id
    end
  end
  </code></pre>
  
  <p>I'm sure :reference is supposed to be equivalent to "t.references :clown" but I can't find the documentation (big surprise). API says add_column: <code>Instantiates a new column for the table. The type parameter is normally one of the migrations native types, which is one of the following: :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean.</code> </p>
  
  <p>...with no <em>reference</em> to :reference.</p>