code: def process_search_hash resource, hash
          conditions = hash.keys.map do |key|
            assoc = resource.reflect_on_association(key)
            if assoc.options[:polymorphic]
              next
            else
              resource = resource.joins <<-SQL
                LEFT JOIN #{assoc.table_name}
                  on (#{resource.table_name}.#{assoc.foreign_key} = #{assoc.klass.table_name}.#{assoc.klass.primary_key})
              SQL
              if hash[key].is_a? Symbol or hash[key].is_a? String
                "#{assoc.table_name}.#{hash[key]} like ?"
  
              elsif hash[key].is_a? Array
                hash[key].map{|col| "#{assoc.table_name}.#{col} like ?" }
  
              elsif hash[key].is_a? Hash
                process_search_hash(resource, hash[key])
  
              end
            end
          end
          return resource, conditions
        end
docs: =============================================================================