change ActiveRecord joins query with custom generated SQL
This commit is contained in:
@@ -55,8 +55,16 @@ module PgSearchable
|
||||
|
||||
def ts_search(value)
|
||||
return if @ts_search_fields.blank? || value.blank?
|
||||
includes(@ts_joins).references(:all).where(
|
||||
TextToSqlQuery.new(value, @ts_search_fields, @default_fields, @ts_search_fields_mappings).where_clause).distinct
|
||||
model = ancestors.first
|
||||
sql_query_object = TextToSqlQuery.new(
|
||||
value,
|
||||
@ts_search_fields,
|
||||
@default_field,
|
||||
@ts_search_fields_mappings,
|
||||
@ts_joins,
|
||||
model
|
||||
)
|
||||
joins(sql_query_object.join_clause).where(sql_query_object.where_clause).distinct
|
||||
end
|
||||
|
||||
def should_update_cache_field?
|
||||
|
||||
Reference in New Issue
Block a user