Forum: Ruby on Rails RE: habtm questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Buntin, Seth - KATE (Guest)
on 2006-03-09 20:12
(Received via mailing list)
class Bag < ActiveRecord::Base
  has_and_belongs_to_many :packages
end
Zac E. (Guest)
on 2006-03-09 21: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.