Refactoring Rails scope method CASE-WHEN-THEN-ELSE-END in MySQL
I'm using MySQL and upgrading my application to Rails 7. In doing so, I've to refactor some order-related queries in my scope methods. Before of Rails 7 I was using the following scope method (call it the "original scope method"):…