23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/administrate_filterable/filterer.rb', line 23
def filtered_resources(resources)
@filterable_attributes = AdministrateFilterable::FiltererService.filter_attributes(dashboard, new_resource)
filter_params = params[resource_name]
return resources if filter_params.blank?
filter_params.each do |key, value|
next unless resources.column_names.include?(key.to_s) && value.present?
sanitized_query = ActiveRecord::Base.send(:sanitize_sql_array, ["#{key} LIKE ?", "%#{value}%"])
resources = resources.where(sanitized_query)
end
resources
end
|