Closed slead closed 6 years ago
I discovered that the problem only applied to existing photos, where the sort
value was null. If I created a new photo, and/or manually calculated the existing photos' sort
values to 0, the plugin worked as expected.
Thanks again for writing this excellent tool.
Thanks for writing this excellent gem. This is a slightly complicated issue so I don't expect you to debug it for me, but I'm hoping you might have some pointers.
TLDR: do you have any suggestions why the sorting might be persisted on localhost, but not Heroku?
I'm using
rails_sortable
successfully on a Rails 5.1.5 / Ruby 2.4.0p0 application that's running on my Mac. I have a Posts model with related Photos, to which I added the integersort
column using a Rails migration. When running on localhost I can successfully re-order the photos using drag-and-drop, and the sort order of the Photos is persisted when I save the Post.The app was already running on Heroku, so I pushed the
rails_sortable
changes, ran the rake task and database migration, and the app still runs without error.I can see in the Rails Console that the Photos model has the integer
sort
column. However, all of the Photos have a nullsort
value, and although I can drag-and-drop the photos in the view to re-order them, the sort order is not persisted when I save the Post - and after saving the Post, thesort
values on the photos are still null.Do you have any suggestions for how I might debug this? Thanks
Model
View
application.js