Rails 3: habtm migration, primary key issue
- by Brian Wigginton
I'm trying to setup a migration file for a habtm relationship, however when I run the migration I'm getting the following error:
Primary key is not allowed in a
has_and_belongs_to_many join table
(parts_vehicles).
Here is my migration file (20110111035950_create_parts_vehicles.rb):
class CreatePartsVehiclesJoinTable < ActiveRecord::Migration
def self.up
create_table :parts_vehicles, :id => false do |t|
t.integer :part_id
t.integer :vehicle_id
end
end
def self.down
drop_table :parts_vehicles
end
end
The documentation example states to use :id => false to disable a primary key from being generated, but I'm still getting the error.