From c12307faa9fe943e98fbae7fd2e59a4300ad8232 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Sun, 19 Nov 2023 15:14:03 +0100 Subject: [PATCH] fix for like_with_wildcard --- lib/additionals/entity_methods_global.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/additionals/entity_methods_global.rb b/lib/additionals/entity_methods_global.rb index 3a6397b4..5ee96626 100644 --- a/lib/additionals/entity_methods_global.rb +++ b/lib/additionals/entity_methods_global.rb @@ -80,7 +80,13 @@ def like_pattern(value, wildcard = nil) def like_with_wildcard(columns:, value:, wildcard: :none) sql = [] Array(columns).each do |column| - sql << "LOWER(#{connection.quote_column_name column}) LIKE LOWER(:p) ESCAPE :s" + col = if column.include? '.' + col_t, col_c = column.split '.' + "#{connection.quote_table_name col_t}.#{connection.quote_column_name col_c}" + else + connection.quote_column_name column + end + sql << "LOWER(#{col}) LIKE LOWER(:p) ESCAPE :s" end sql_string = sql.join ' OR '