I have a concrete table with an associated join table and I'm trying to load up some test data but cannot seem to get the fixtures file correct. The parent/child relationship works great but the fixtures fail to load. Any help would be greatly appreciated.
Here is what I have...
# app/models/node.rb class Node < ActiveRecord::Base belongs_to :category belongs_to :status
has_one :parents, :class_name => "NodeGroup", :foreign_key => "child_id"
has_one :parent, :through => :parents
has_many :children, :class_name => "NodeGroup", :foreign_key => "parent_id"
end
# app/models/node_group.rb class NodeGroup < ActiveRecord::Base belongs_to :parent, :class_name => "Node" belongs_to :child, :class_name => "Node" end
# test/fixtures/nodes.yml parent1: name: Parent1 children: child1
parent2: name: Parent2
child1: name: Child1