ActiveRecord::QueryMethods | unexpected behaviors when unscoping?


One of my devs has been attempting to use ActiveRecord::QueryMethods#unscope for a relation extension he’s working on.

In doing so, he ran into a couple of unexpected behaviors that I helped trace to Rails source.

I wanted to start here before writing tests, a patch, and/or issuing a pull request to ask a couple of questions. Apologies in advance if any of these are ignorant:

  1. Do y’all agree that the following gist exhibits unexpected behaviors?

  • Is there a reason for the specific list of Arel Node classes (e.g. excluding things like Arel::Nodes::LessThan)?

  • Is there a reason to not support unscoping for string/array where_values?

  1. If so, should I be branching from a 4-2 branch for a fix, or master?

Thanks for your time and attention!

  • Evan Prothro