Simplify search_params in search_controller

This commit is contained in:
Lars Henrik Mai 2016-02-17 21:04:53 +01:00
parent a82b1bd1b7
commit 8890354909

View file

@ -7,7 +7,7 @@ end
class SearchController < ApplicationController class SearchController < ApplicationController
def index def index
@search_definition = params[:paper_search].present? ? PaperSearch.new(search_params) : PaperSearch.new @search_definition = PaperSearch.new(search_params)
@search_definition.sort_by ||= "score" @search_definition.sort_by ||= "score"
execute_search execute_search
@ -29,7 +29,7 @@ class SearchController < ApplicationController
end end
def search_params def search_params
params.require(:paper_search).permit(:query, :paper_type, :originator, :sort_by) params.fetch(:paper_search, {}).permit(:query, :paper_type, :originator, :sort_by)
end end
def extract_facets(name) def extract_facets(name)