Sha256: 706e6596373929c05c038a4c9a414c407a900b1f52ba3491336891006f41851e
Contents?: true
Size: 895 Bytes
Versions: 18
Compression:
Stored size: 895 Bytes
Contents
module Spotlight # Create and update filters for an exhibit class FiltersController < ApplicationController before_action :authenticate_user! load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit' load_and_authorize_resource through: :exhibit def create if @filter.save flash[:notice] = t('helpers.submit.filter.updated', model: @filter.model_name.human) else flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe) end redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter' end def update unless @filter.update(filter_params) flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe) end redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter' end def filter_params params.require(:filter).permit(:field, :value) end end end
Version data entries
18 entries across 18 versions & 1 rubygems