use flat concatenation instead of nesting conditions
closes #805
Thanks for you PR. Could this lead to different results if the conditions are now "joined" without parenthesis?
Thanks for you PR. Could this lead to different results if the conditions are now "joined" without parenthesis?
I think this change should be okay, but I can not guarantee it. (I just copied the solution from the archived cancan project: https://github.com/ryanb/cancan/issues/414 )
I just started the test suite and there are some failing examples, which would need to be adjusted.
DB='sqlite' bundle exec appraisal activerecord_7.0.0 rake
537 examples, 12 failures, 3 pending
expected: "not (\"articles\".\"secret\" = 1) AND ((\"articles\".\"published\" = 1) OR (\"articles\".\"id\" = 1))"
got: "(not (\"articles\".\"secret\" = 1) AND (\"articles\".\"published\" = 1) OR \"articles\".\"id\" = 1)"
etc
I also found out, that the problem seems to be resolved with the latest version of sqlite3 (2.0.2) So maybe we don't even need this fix in the future