Sha256: 42a81dc852a330ff481c751dad2b564f9e25dff45b49abf8960a6d38d187578c
Contents?: true
Size: 908 Bytes
Versions: 58
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true 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 flash[:alert] = @filter.errors.full_messages.join('<br/>'.html_safe) unless @filter.update(filter_params) 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
58 entries across 58 versions & 1 rubygems