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

Ticket #7323 (closed defect: untested)

Opened 1 year ago

Last modified 1 year ago

acts_as_list fails with unique index and has_many relationship

Reported by: lonestarsoftware Assigned to: bitsweat
Priority: normal Milestone: 1.2
Component: ActiveRecord Version: edge
Severity: normal Keywords: acts_as_list unique
Cc:

Description (Last modified by bitsweat)

The attachment includes tests to demonstrate this problem. When using acts_as_list, has_many and a unique index, delete_all fails with a duplicate record error.

Attachments

acts_as_list_tests_patch.diff (2.3 kB) - added by lonestarsoftware on 01/23/07 07:37:06.

Change History

01/23/07 07:37:06 changed by lonestarsoftware

  • attachment acts_as_list_tests_patch.diff added.

01/28/07 09:53:00 changed by bitsweat

  • keywords set to acts_as_list unique.
  • milestone changed from 1.x to 1.2.

(follow-up: ↓ 4 ) 01/28/07 13:40:00 changed by bitsweat

  • owner changed from core to bitsweat.
  • description changed.
  • summary changed from [PATCH] acts_as_list fails with unique index and has_many relationship to acts_as_list fails with unique index and has_many relationship.

The patch gives me several test failures, but none with the new test case. Could you describe or troubleshoot further?

01/28/07 13:40:56 changed by bitsweat

  • description changed.

Removing [PATCH] since there is no fix included.

(in reply to: ↑ 2 ) 01/29/07 23:04:17 changed by lonestarsoftware

Replying to bitsweat:

The patch gives me several test failures, but none with the new test case. Could you describe or troubleshoot further?

I have a unique index in MySQL on (parent_id, position). When I do a parent.children.clear, I get a MySQL duplicate record error on my unique index as acts_as_list is trying to update the positions. I've tried destroy_all and delete_all and they all do the same thing. Ideally, the clear() or delete_all() should map to DELETE FROM children WHERE parent_id = ?

01/30/07 01:48:19 changed by bitsweat

  • status changed from new to closed.
  • resolution set to untested.

Could you encapsulate that in a failing unit test? Thanks!