I have a Role model and Permission model.
The Role model:
has_and_belongs_to_many :permissions
The Permission model:
has_and_belongs_to_many :roles
The migration to create the permissions_roles table:
class CreatePermissionsRoles < ActiveRecord::Migration
def self.up
create_table :permissions_roles, :id => false do |t|
t.integer :permission_id
t.integer :role_id
end
end
def self.down
drop_table :permissions_roles
end
end
When I try to assign permissions to a role, I get the error "Invalid column name 'id'." Further examination reveals that the query attempting to execute is:
INSERT INTO "permissions_roles" ("permission_id", "role_id", "id") VALUES (1, 1, 1)
Why in the world is it attempting to add a row with an id value?