Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acts_as_list not updating position when scoped field is indexed #351

Closed
map7 opened this issue Jul 5, 2019 · 4 comments
Closed

acts_as_list not updating position when scoped field is indexed #351

map7 opened this issue Jul 5, 2019 · 4 comments

Comments

@map7
Copy link

map7 commented Jul 5, 2019

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.

@brendon
Copy link
Owner

brendon commented Jul 5, 2019

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?

@map7
Copy link
Author

map7 commented Jul 7, 2019

Same problem if I use client_id

@brendon
Copy link
Owner

brendon commented Jul 8, 2019

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?

@brendon
Copy link
Owner

brendon commented Jun 4, 2024

Closing due to lack of contact.

@brendon brendon closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants