I’ve searched around and have not found a way to add a reference
column to an existing table, I guess it would be something like
class AddProjectReferenceToTask < ActiveRecord::Migration
add_reference :tasks, :projects
remove_reference :tasks, :projects
of course the methods don’t exist but you get an idea of what the
problem is, man I need that AWDR for 2.0…
Um, you mean an association, right?
I’m assuming it’s a HABTM one,
create_table :projects_tasks, :id => false do |t|
t.integer :project_id, :task_id
now I see what the problem was, I thought that by doing
t.references :project the migration would do the reference on mysql,
instead of just creating the field for the FK.
It’s a one to many so all I had to do to add the reference was
add_column :tasks, :project_id, :integer