I think we need to see one your kid/sport model and then the new/ create method in the controller...
You should not have a id column btw in the kids_sports table.. . This should be your up task: def self.up create_table :kids_sports, :id => false do |t| t.integer :kid_id t.integer :sport_id end add_index :kids_sports, [:kid_id] add_index :kids_sports, [:sport_id] end On Feb 2, 12:58 pm, Little Known <rails-mailing-l...@andreas-s.net> wrote: > I have Kids and I have Sports. > > I have a checkbox list of Sports for each Kid. > > Let's say I make a Kid, and assign him to all 5 sports. > > It works, great. > > Let's say I make another Kid(Kid2), and assign him to all 5 sports. I > get this error: > > Mysql::Error: Duplicate entry '2' for key 1: INSERT INTO kids_sports > (`sport_id`, `kid_id`, `id`) VALUES (2, 10, 2) > > And my kids_sports table looks like this: > > id kid_id sport_id > Edit Delete 2 8 2 > Edit Delete 3 8 3 > Edit Delete 4 8 4 > Edit Delete 6 8 6 > Edit Delete 7 8 7 > > Why the heck is it doing that? Why isn't id 1,2,3,4,5 etc like it > should(?) be? > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---