Displaying 1 result from an estimated 1 matches for "createnodesnodes".
2007 Oct 22
1
self-referential habtm: why are my keys null?
...n both key columns (or 0''s if I turn on the no-null
constraint).
Here are the migrations:
class CreateNodes < ActiveRecord::Migration
def self.up
create_table :nodes do |t|
t.column :name, :string
end
end
def self.down
drop_table :nodes
end
end
class CreateNodesNodes < ActiveRecord::Migration
def self.up
create_table :nodes_nodes, :id => false do |t|
t.column :parent_id, :integer
t.column :child_id, :integer
end
end
def self.down
drop_table :nodes_nodes
end
end
And here is the model:
class Node < Active...