Module: ActiveAdmin::ResourceController::Collection::Search

Included in:
ActiveAdmin::ResourceController::Collection
Defined in:
lib/active_admin/resource_controller/collection.rb

Instance Method Summary collapse

Instance Method Details

#active_admin_collectionObject (protected)



66
67
68
# File 'lib/active_admin/resource_controller/collection.rb', line 66

def active_admin_collection
  search(super)
end

#clean_search_params(search_params) ⇒ Object (protected)



75
76
77
78
79
80
81
82
# File 'lib/active_admin/resource_controller/collection.rb', line 75

def clean_search_params(search_params)
  return {} unless search_params.is_a?(Hash)
  search_params = search_params.dup
  search_params.delete_if do |key, value|
    value == ""
  end
  search_params
end

#search(chain) ⇒ Object (protected)



70
71
72
73
# File 'lib/active_admin/resource_controller/collection.rb', line 70

def search(chain)
  @search = chain.metasearch(clean_search_params(params[:q]))
  @search.relation
end