#740 ✓resolved
Brian Terlson

dm-is-list #reorder_list doesn't function properly

Reported by Brian Terlson | January 2nd, 2009 @ 01:38 PM | in 0.10.0

Reordering a list doesn't set the positions correctly.

%w(rubygems dm-core dm-is-list).each{|r| require r }

DataMapper.setup(:default, 'sqlite3::memory:')

class Todo
  include DataMapper::Resource

  property :id, Serial
  property :title, String

  is :list


@todo_1 = Todo.create(:title => "Flip mattress")
@todo_2 = Todo.create(:title => "Empty trash")
@todo_3 = Todo.create(:title => "Do something fun")
@todo_4 = Todo.create(:title => "Clean the house")
@todo_5 = Todo.create(:title => "Brush the dogs")
@todo_6 = Todo.create(:title => "Arrange bookshelf")


# => "[#<Todo id=1 title=\"Flip mattress\" position=6>, #<Todo id=2 title=\"Empty trash\" position=4>, #<Todo id=3 title=\"Do something fun\" position=3>, #<Todo id=4 title=\"Clean the house\" position=1>, #<Todo id=5 title=\"Brush the dogs\" position=1>, #<Todo id=6 title=\"Arrange bookshelf\" position=0>]"

There are duplicate positions (position 1), a position below the minimum position (position 0).

Comments and changes to this ticket

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by