app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-0.5.0 vs app/controllers/spotlight/searches_controller.rb in blacklight-spotlight-0.6.0
- old
+ new
@@ -9,21 +9,19 @@
load_and_authorize_resource through: :exhibit
before_action :attach_breadcrumbs, only: [:index, :edit], unless: -> { request.format.json? }
include Spotlight::Base
- # rubocop:disable Metrics/AbcSize
def create
@search.attributes = search_params
@search.query_params = params.except(:exhibit_id, :search, *blacklisted_search_session_params).reject { |_k, v| v.blank? }
if @search.save
redirect_to :back, notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase)
else
redirect_to :back, alert: @search.errors.full_messages.join('<br>'.html_safe)
end
end
- # rubocop:enable Metrics/AbcSize
def index
respond_to do |format|
format.html
format.json { render json: @searches.published.as_json(methods: [:count, :thumbnail_image_url]), root: false }