Unit test fails when trying to load legacy join table fixtur

my misadventures in the realm of testing continue… here’s the

testing the methods of a model and one of them does some link table
look up to find records in a habtm relationship… the join table wasn’t
exactly made with rails in mind, but it is not so far off…

the message i get when trying to load the join table fixture is this:

  1. Error:
    ActiveRecord::RecordNotFound: Couldn’t find InventoryDescription
    without an ID












I have another join table that is built the way it should be and the
fixture loads fine… anyways here’s the discrepancies with the join
table who’s fixture doesn’t want to load properly:


create_table “inventory_descriptions”, :id => false, :force => true
do |t|
t.column “inventory_id”, :integer, :default => 0, :null => false
t.column “description_id”, :integer, :default => 0, :null => false
t.column “lastupdate”, :timestamp

as you can see the :id => false is set so that follows rails
conventions… not sure about whether giving the link an extra
‘lastupdate’ attribute is kosher. the other join tables i did didn’t
have any extra info for the links… Also, i know that the name should
be descriptions_inventory, but is that really that big of a deal? in
the model i set the table name accordingly (see below)

class InventoryDescription < ActiveRecord::Base
set_table_name “inventory_descriptions”
#set_primary_key “inventory_id, description_id”

Also, in inventory model i have: has_and_belongs_to_many :descriptions
and in descriptions: has_and_belongs_to_many :inventory
inventory model also sets tablename to ‘inventory’ since i wasn’t sure
if rails conventions would think it should be name inventories…

a sample of the fixture for the link table:

description_id: “285”
inventory_id: “1259”
lastupdate: 2006-09-13 17:36:14
description_id: “257”
inventory_id: “207”
lastupdate: 2006-09-13 17:36:33
… etc

So what steps do i need to take to get the fixture to load and continue
testing? the actual app code seems to work fine for these tables
although it doesn’t use the magical linking stuff
(inv_instance.descriptions or desc_instance.inventory)

thanks in advance,