lib/bootstrap_admin/responder.rb
def process_search resource
        result = resource
        fields = search_fields resource

        if controller.params[:q] and !fields.blank?
          conditions = fields.map do |field|
            if field.is_a? Symbol or field.is_a? String
              "#{resource.table_name}.#{field} like ?"

            elsif field.is_a? Hash
              resource, sconds = process_search_hash(resource, field)
              sconds
            end
          end.flatten.compact

          params = ["%#{controller.params[:q]}%"] * conditions.count
          result = resource.where(conditions.join(" OR "), *params)
        end

        result
      end
def process_search resource
        result = resource
        fields = search_fields resource

        if controller.params[:q] and !fields.blank?
          conditions = fields.map do |field|
            if field.is_a? Symbol or field.is_a? String
              "#{resource.table_name}.#{field} like ?"

            elsif field.is_a? Hash
              resource, sconds = process_search_hash(resource, field)
              sconds
            end
          end.flatten.compact

          params = ["%#{controller.params[:q]}%"] * conditions.count
          result = resource.where(conditions.join(" OR "), *params)
        end

        result
      end
def process_search resource result = resource fields = search_fields resource if controller . params [ :q ] and ! fields . blank? conditions = fields . map do | field | if field . is_a? Symbol or field . is_a? String "#{resource.table_name}.#{field} like ?" elsif field . is_a? Hash resource , sconds = process_search_hash ( resource , field ) sconds end end . flatten . compact params = [ "%#{controller.params[:q]}%" ] * conditions . count result = resource . where ( conditions . join ( " OR " ) , params ) end result end
=============================================================================
=============================================================================