Displaying 1 result from an estimated 1 matches for "nodes_nodes".
2007 Oct 22
1
self-referential habtm: why are my keys null?
...e 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 < ActiveRecord::Base
has_and_belongs_to_many :parents, :foreign_key => :chi...