app/controllers/admin/cms_controller.rb
def custom_search

      # if we’ve no searchable fields, then just fail out
      return [] if @searchable_fields.empty?

      # otherwise, construct our query
      fields = []
      values = []
      @searchable_fields.each do |f|

        fields << "#{f} LIKE ?"
        values << "%#{params[:search]}%"

      end

      # run the query
      @model_class.where( fields.join( ' OR '), *values )


    end
# Internal function to allow overriding of the search.
Internal function to allow overriding of the search.
Internal function to allow overriding of the search .
def custom_search
      return [] if @searchable_fields.empty?
      fields = []
      values = []
      @searchable_fields.each do |f|
        fields << "#{f} LIKE ?"
        values << "%#{params[:search]}%"
      end
      @model_class.where( fields.join( ' OR '), *values )
    end
def custom_search return [ ] if @searchable_fields . empty? fields = [ ] values = [ ] @searchable_fields . each do | f | fields << "#{f} LIKE ?" values << "%#{params[:search]}%" end @model_class . where ( fields . join ( ' OR ' ) , * values ) end
Internal function to allow overriding of the search.
Internal function to allow overriding of the search .
# if we’ve no searchable fields, then just fail out # otherwise, construct our query # run the query