Skip to content

use flat concatenation instead of nesting conditions - #806

Open
NikolaiKircher wants to merge 1 commit into
CanCanCommunity:developfrom
NikolaiKircher:fix/nested_conditions
Open

use flat concatenation instead of nesting conditions#806
NikolaiKircher wants to merge 1 commit into
CanCanCommunity:developfrom
NikolaiKircher:fix/nested_conditions

Conversation

@NikolaiKircher

@NikolaiKircher NikolaiKircher commented Nov 17, 2022

Copy link
Copy Markdown

closes #805

@NikolaiKircher
NikolaiKircher force-pushed the fix/nested_conditions branch from 750bc41 to 4814bda Compare May 28, 2024 07:56
@coorasse

coorasse commented May 28, 2024

Copy link
Copy Markdown
Member

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

@NikolaiKircher

Copy link
Copy Markdown
Author

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: ryanb/cancan#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deep conditions nesting on sqlite => stack overflow

3 participants