Jay Davis
10/12/2022, 8:34 PMSpree::Relation
records have a position field that is nil by default; they have to be reordered before the position number gets assigned (it doesn't appear to use acts_as_list
-- the assignment occurs in Spree::Admin::RelationsController
). Is there a better way of changing this behavior than overriding the controller/view?Chris Todorov
10/12/2022, 9:16 PMacts_as_list
based on the instructions here https://github.com/brendon/acts_as_list#adding-acts_as_list-to-an-existing-model. You are probably going to want to scope the ordering as well, though I am not exactly sure how this gem works so I wouldn’t know on which field (maybe by relation_type
and relateable_id
). Alternatively you can also override the model and add a custom hook that does something similar to what acts_as_list
would do on a before_save
hook.Jay Davis
10/13/2022, 3:09 PMacts_as_list
to the model, which shouldn't clash with the existing functionality.Chris Todorov
10/13/2022, 3:24 PM