Is it possible to automatically populate a join table with table data
through migrations? So far, I have been able to do it with tables as
in the following example:
class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.column :title, :string
end
Category.create(:title => "My first cateegory data")
end
def self.down
drop_table :categories
end
end
=====
How would this migration change if, say, I wanted to create a table
called “categories_subcategories” ?
I’m able to generate the table, but not populate the table. Perhaps it
isn’t possible since I’m not generating a model? If it is possible,
what would be the equivalent of the “Category” object in the above
example?
Thanks in advance,
Raphael