From 4814bdae1f7c32ac2118eab3c0e3c68c0aff4af8 Mon Sep 17 00:00:00 2001 From: Nikolai Kircher Date: Thu, 17 Nov 2022 15:51:23 +0100 Subject: [PATCH] use flat concatenation instead of nesting --- lib/cancan/model_adapters/active_record_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cancan/model_adapters/active_record_adapter.rb b/lib/cancan/model_adapters/active_record_adapter.rb index 33766c0a..04888306 100644 --- a/lib/cancan/model_adapters/active_record_adapter.rb +++ b/lib/cancan/model_adapters/active_record_adapter.rb @@ -202,7 +202,7 @@ def merge_non_empty_conditions(behavior, conditions_hash, sql) when false_sql behavior ? conditions : false_sql else - behavior ? "(#{conditions}) OR (#{sql})" : "not (#{conditions}) AND (#{sql})" + behavior ? "(#{conditions}) OR #{sql}" : "(not (#{conditions}) AND #{sql})" end end