brendon / acts_as_list

An ActiveRecord plugin for managing lists.
http://brendon.github.io/acts_as_list/
MIT License
2.04k stars 355 forks source link

Be more precise with unscope-ing #263

Closed brendon closed 7 years ago

brendon commented 7 years ago

Hi @fabn, I was wondering if you could travel back in time and give a bit more detail as to your intention with this commit?:

https://github.com/swanandp/acts_as_list/commit/4a45dca9bf9059ce5491d2bb576e7f7eed9cd82c

I've been having deadlock issues around the :order scope being cleared in aal updates (e.g. shuffling the table) vs other updates where the default_scope is kept intact.

What do you think about just calling: .unscope(:where) instead? Are there other scope types we'd need to unscope? I don't think there is as we really only want to make sure that our .where clauses are the only ones in there.

What do you think @swanandp?

fabn commented 7 years ago

Hi @brendon, I think you are right, .unscope(:where) should be enough, but it will mean to drop compatibility with rails 3 since that method is only available with rails >= 4.0.

Maybe except could help to preserve rails 3 compatibility.

swanandp commented 7 years ago

I will get to this shortly.

brendon commented 7 years ago

I've had good success with this PR. Let's see how the CI runs for all scenarios. I had to .reorder instead of .order but again, that's less of a blunt instrument.