Skip to content

Commit

Permalink
fix for like_with_wildcard
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Nov 19, 2023
1 parent e6a7f17 commit c12307f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/additionals/entity_methods_global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down

0 comments on commit c12307f

Please sign in to comment.