swanandp/acts_as_list — Issue #31: Duplicated positions when creating parent and children from scratch in 0.1.5
Author: jmbejar
Created: 2012-03-06 15:05:04+00:00
State: open

I have a problem after upgrade to 0.1.5.

```ruby
class TodoList < ActiveRecord::Base
has_many :todo_items, :order => "position"
end

class TodoItem < ActiveRecord::Base
belongs_to :todo_list
acts_as_list :scope => :todo_list
end

list = TodoList.new
3.times { list.todo_items.build }
list.save
```

Creating the parent and the children from scratch generate odd values for positions (sometimes the same repeated value). It used to work fine with 0.1.4 (I'm using rails 3.0.10)

As far I checked it was broken after move the move_to_bottom callback to a before_validation callback, it worked with 0.1.4 because move_to_bottom was a before_create callback.