cancancan icon indicating copy to clipboard operation
cancancan copied to clipboard

use flat concatenation instead of nesting conditions

Open NikolaiKircher opened this issue 3 years ago • 2 comments

closes #805

NikolaiKircher avatar Nov 17 '22 14:11 NikolaiKircher

Thanks for you PR. Could this lead to different results if the conditions are now "joined" without parenthesis?

coorasse avatar May 28 '24 09:05 coorasse

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

NikolaiKircher avatar May 28 '24 10:05 NikolaiKircher