Method: Spotlight::SearchesController#create

Defined in:
app/controllers/spotlight/searches_controller.rb

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spotlight/searches_controller.rb', line 14

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