brendon / ranked-model

An acts_as_sortable/acts_as_list replacement built for Rails 4+
https://github.com/mixonic/ranked-model
MIT License
1.09k stars 134 forks source link

Publish ActiveSupport notifications on rebalancing #203

Closed tjvc closed 3 months ago

tjvc commented 3 months ago

Record updates to rebalance ranks do not trigger ActiveRecord callbacks. This makes it difficult to react to these updates (for example, to index them in a secondary data store). This commit instruments the updates with ActiveSupport notifications. Subscribed consumers receive an event for each rearrangement or rebalancing, the payload of which includes the triggering instance and the scope and with_same options for the ranking, which can be used to retrieve the affected records.

Addresses #202.

brendon commented 3 months ago

Looks great! Can you drop Ruby 2.4 out of the test matrix? No point in supporting that if we can't install the required gems anymore (without effort).

tjvc commented 3 months ago

Can you drop Ruby 2.4 out of the test matrix?

Done in b2cc18a - thanks!

brendon commented 3 months ago

Great! :) Looks nice to me. Did you want to do some testing with master before I release it as a version?

tjvc commented 3 months ago

Looking good over here - would be great to get it released! Thanks for your responsiveness and openness to this change! 🙇‍♂️

brendon commented 3 months ago

No worries at all :) I'll do a release now :D