Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11451 (new defect)

Opened 2 years ago

PATCH: habtm foxy fixtures do not load duplicate inline associations (even when unique option isn't set)

Reported by: garru Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords:
Cc:

Description

In the case where your habtm doesn't have the unique option set to true one I think the following should be allowed:

class Contestant < ActiveRecord::Base

has_and_belongs_to_many :kills

end

class Score < ActiveRecord::Base

has_and_belongs_to_many :contestants

end

scores.yaml

mario_score:

kills: marth_contestant, marth_contestant, samus_contestant

I would assume should load

scores(:mario_score).kills = [ Marth, Marth, Samus ]

instead all duplicates are removed.

I've included a patch to fix this behavior

Attachments

fixtures.rb.diff (0.6 kB) - added by garru on 03/28/08 03:36:51.

Change History

03/28/08 03:36:51 changed by garru

  • attachment fixtures.rb.diff added.