Forum: Ruby on Rails RE: habtm questions

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E4c4a05719644c37f02dc5181de7c8c5?d=identicon&s=25 Buntin, Seth - KATE (Guest)
on 2006-03-09 19:12
(Received via mailing list)
class Bag < ActiveRecord::Base
  has_and_belongs_to_many :packages
Af656cca6a3806277fe19a0c606ddab7?d=identicon&s=25 Zac Elston (zaq)
on 2006-03-09 20:02
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.
This topic is locked and can not be replied to.