brendon / acts_as_list

An ActiveRecord plugin for managing lists.

Home Page:http://brendon.github.io/acts_as_list/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

acts_as_list not updating position when scoped field is indexed

map7 opened this issue · comments

I have a client which has many addresses and each address I use acts_as_list scoped by the client. My client_id in the addresses table has an index attached to it which broke my tests.

acts_as_list scope: :client

Now when I add the first address it gets position 1, and the second gets position 1. If I remove the index on client_id, then it works as expected. The first address gets position 1, and the second address I add to the client gets position 2. The only thing I changed was removing the index on client_id.

That's a strange one. I can't see how the index would be interacting with it. It's best to explicitly scope on the column name, so :client_id. Can you try that and let me know?

Same problem if I use client_id

Thanks for reporting back. Probably the next thing to look at doing is creating a failing test in our test suite. Do you think you'll be able to do that for me so we can investigate further? I assume you're just creating a standard index using rails migrations?

Closing due to lack of contact.