Skip to content

Commit

Permalink
fix(search): does not apply the extended search for polymorphic relat…
Browse files Browse the repository at this point in the history
…ionships (#684)
  • Loading branch information
nicolasalexandre9 authored Jul 2, 2024
1 parent 1211211 commit d4c74e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/services/forest_liana/search_query_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,17 @@ def search_param
end
association_search = association_search.compact
end

if @includes.include? association.to_sym
resource = @resource.reflect_on_association(association.to_sym)
resource.klass.columns.each do |column|
if !(column.respond_to?(:array) && column.array) && text_type?(column.type)
if @collection.search_fields.nil? || (association_search &&
association_search.include?(column.name))
conditions << association_search_condition(resource.table_name,
column.name)
unless (SchemaUtils.polymorphic?(resource))
resource.klass.columns.each do |column|
if !(column.respond_to?(:array) && column.array) && text_type?(column.type)
if @collection.search_fields.nil? || (association_search &&
association_search.include?(column.name))
conditions << association_search_condition(resource.table_name,
column.name)
end
end
end
end
Expand Down

0 comments on commit d4c74e8

Please sign in to comment.