app/controllers/lcms/engine/admin/standards_controller.rb in lcms-engine-0.3.0 vs app/controllers/lcms/engine/admin/standards_controller.rb in lcms-engine-0.3.1
- old
+ new
@@ -3,15 +3,16 @@
module Lcms
module Engine
module Admin
class StandardsController < AdminController
before_action :find_standard, except: [:index]
+ before_action :set_query_params
def edit; end
def index
- @query = OpenStruct.new params[:query]
+ @query = OpenStruct.new @query_params
scope = Standard.order(:id)
scope = scope.search_by_name(@query.name) if @query.name.present?
@standards = scope.paginate(page: params[:page])
@@ -27,9 +28,13 @@
private
def find_standard
@standard = Standard.find(params[:id])
+ end
+
+ def set_query_params
+ @query_params = params[:query]&.permit(:name) || {}
end
def standard_params
params.require(:standard).permit(:description)
end