-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
move_lower and move_higher not working returning nil #57
Comments
I too had this problem after setting up acts_as_list when there was existing data in the table. It appears that move_lower/move_higher will not move an item if the position column value is null, or if only one item has a position. This makes sense, but is not immediately obvious. To resolve this, I set a default position for all items using a migration: execute "UPDATE sortable_table SET position = id" |
@shaileshparamisoft I think upgrading to latest should solve your problem. |
But if not, let me know. |
@swanandp Yes, the issue has been resolved. |
I'm still getting nil when setting it up, because all my position columns are nil. |
I had a Category hierarchy in my app and had the same problem with null position values. I solved it by adding this method to the migration that created the position column:
This is assuming |
I fixed this problem by making a rake task (as DB updates generally shouldn't be done in migrations). See: https://stackoverflow.com/a/15531843/380607 |
Hi,
I am using Rails 3.2.6 application with acts_as_list(0.1.6) gem included in my Gemfile.
I have the code as follows
I have position(integer) column in the product_stores table . But the move_lower and move_higher functions does not work returning nil and the product is not moved to any position without updating the position. e.g
Hw to resolve it ?
The text was updated successfully, but these errors were encountered: