Class: Admin::SearchController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::SearchController
- Includes:
- Effective::CrudController
- Defined in:
- app/controllers/admin/search_controller.rb
Instance Method Summary collapse
Instance Method Details
#build_search ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/admin/search_controller.rb', line 18 def build_search search = EffectiveSearch.AdminSearch.new() search.assign_attributes(search_params.select { |k, _| search.respond_to?("#{k}=") }) search.assign_attributes(current_user: current_user, view_context: view_context) search end |
#index ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/admin/search_controller.rb', line 8 def index EffectiveResources.(self, :index, EffectiveSearch.AdminSearch) # But more often we do a full membership directory search screen @search = build_search @search.search! @page_title = "Search" end |
#search_params ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/search_controller.rb', line 25 def search_params return {} unless params[:q].present? if params[:q].respond_to?(:to_h) # From the search form params.require(:q).permit! else { term: params.permit(:q).fetch(:q) } # From the url /directory?q=asdf end end |