
Can't move list item immediately after creating it
Reported by Brian Terlson | January 1st, 2009 @ 02:48 PM | in 0.10.0
You cannot move a list item immediately after creating it because the moved attribute is set to true after creation, which causes further movement to be skipped. Attempting to move an item without first reloading it from the database will result in a broken list. To demonstrate:
class TestModel
include DataMapper::Resource
property :id, Serial
is :list
end
DataMapper.auto_migrate!
a = TestModel.create
b = TestModel.create
a.position
# => 1
b.position
# => 2
a.position = 2
a.save
a = TestModel.get(1)
b = TestModel.get(2)
a.position
# => 2
b.position
# => 2
The fix is a one-liner, and I've attached a patch.
Comments and changes to this ticket
-
Brian Terlson January 2nd, 2009 @ 12:51 PM
Here is the commit on github if that's easier for you guys.
-
Dan Kubb (dkubb) January 8th, 2009 @ 04:20 AM
- Assigned user set to Sindre Aarsaether
-
Martin Gamsjaeger (snusnu) July 9th, 2009 @ 07:29 PM
- Milestone set to 0.10.0
A more recent discussion about problems with dm-is-list is going on over at #891 . I'm trying to collect all reported issues with dm-is-list over there because it will make it easier to check if all (reported) cases are solved before 0.10
-
Martin Gamsjaeger (snusnu) July 9th, 2009 @ 07:49 PM
- Assigned user changed from Sindre Aarsaether to Martin Gamsjaeger (snusnu)
- State changed from unconfirmed to accepted
-
Martin Gamsjaeger (snusnu) July 14th, 2009 @ 09:29 AM
- State changed from accepted to resolved
Resolved as of
http://github.com/datamapper/dm-more/commit/e497c24c925223c935c5f2c...
Thx again kematzy!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Attachments
Tags
Referenced by
-
737 New specs for dm-list Some of the specs are left pending, as I've found a few b...
-
891 [patch] is list #735 #737 #738 and #740 are all related to bugs in dm-is-...