From 8890354909c31fd175b28e63ae96dbdcb97afa14 Mon Sep 17 00:00:00 2001 From: Lars Henrik Mai Date: Wed, 17 Feb 2016 21:04:53 +0100 Subject: [PATCH] Simplify search_params in search_controller --- app/controllers/search_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 36df374..f563eb0 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -7,7 +7,7 @@ end class SearchController < ApplicationController 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" execute_search @@ -29,7 +29,7 @@ class SearchController < ApplicationController end 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 def extract_facets(name)