Hi, I've set up a model as follows
class EquipmentPrice < ActiveRecord::Base
acts_as_tree :order => "id"
... end
which has the following db migration class CreateEquipmentPrices < ActiveRecord::Migration def self.up create_table :equipment_prices do |t| t.integer :id t.string :manufacturer t.string :model t.string :equipment_type t.integer :capacity t.integer :string_size t.string :cost_structure t.string :currency t.decimal :price_each t.decimal :price_bulk t.integer :bulk_quantity t.integer :parent_id
t.timestamps end end
def self.down drop_table :equipment_prices end end
But when I try and run the default test, I get an error message stating ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry '1' for key 1: INSERT INTO `equipment_prices` (`id`, `manufacturer`, `model`, `equipment_type`, `capacity`, `string_size`, `cost_structure`, `currency`, `price_each`, `price_bulk`, `bulk_quantity`, `parent_id`, `created_at`, `updated_at`) VALUES (1, NULL, NULL, 'PV_subsystem', NULL, NULL, NULL, 'USD', 0.0, 0.0, 1, 0, '2010-03-11 12:14:05', '2010-03-11 12:14:05')
I have read in an earlier post that this is because I have parent_id set as the primary key for the table. But when I look at the mysql table definition I see