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

Using top_of_list set to 1 and setting a record to index 0 triggers a PG::UniqueViolation #322

Closed
TheNeikos opened this issue Sep 10, 2018 · 5 comments

Comments

@TheNeikos
Copy link
Contributor

TheNeikos commented Sep 10, 2018

I've had quite a headache trying to use this gem, until I saw that top_of_list defaults to 1 and I try starting at 0.

This in turn caused a PG::UniqueViolation due to the incorrect swapping of objects. I think this could be prevented by raising an exception when trying to set an index that is lower than top_of_list ? (Which should be an error anyway imo)

Once I changed that setting the Exception went away, so I assumed that to be the cause.


So my suggestion would be to raise an error when an incorrect position is given

@brendon
Copy link
Owner

brendon commented Sep 10, 2018

Hi @TheNeikos :) We're keen to help improve things. Would you like to look at putting together a PR to add this exception along with a test?

@TheNeikos
Copy link
Contributor Author

@brendon I've opened a PR, let me know if you want anything changed!

@brendon
Copy link
Owner

brendon commented Sep 10, 2018

Roger, will look at this tomorrow :D

@TheNeikos
Copy link
Contributor Author

Ping 😁

@brendon
Copy link
Owner

brendon commented Sep 17, 2018

Sorry about the delay :)

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