RE: habtm questions

class Bag < ActiveRecord::Base
has_and_belongs_to_many :packages
end

Buntin, Seth - KATE wrote:

class Bag < ActiveRecord::Base
has_and_belongs_to_many :packages
end

I get the exact same error with or without this statement.

Mysql::Error: #23000Duplicate entry ‘1’ for key 1: INSERT INTO
bags_packages (id, bag_id, package_id) VALUES (1, 1, 2)

why would a bag need to belong to a package? it may have many, but
certainly not belong to a package.