Sha256: 6c1f4e8cdc1c8ec81da45ae534ac89d0ded83718613a9a05af5d72716a91a145
Contents?: true
Size: 1.7 KB
Versions: 5
Compression:
Stored size: 1.7 KB
Contents
class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController before_action :set_lists def create authorize! :create, WcoEmail::EmailFilter @email_filter = WcoEmail::EmailFilter.create params[:email_filter].permit! if @email_filter.persisted? flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}." end redirect_to action: 'index' end def destroy @email_filter = WcoEmail::EmailFilter.find params[:id] authorize! :destroy, @email_filter flag = @email_filter.destroy if flag flash[:notice] = 'Success' else flash[:alert] = 'Error' end redirect_to action: 'index' end def edit @email_filter = WcoEmail::EmailFilter.find params[:id] authorize! :edit, @email_filter end def index authorize! :index, WcoEmail::EmailFilter.new @email_filter = WcoEmail::EmailFilter.new @email_filters = WcoEmail::EmailFilter.active end def new @email_filter = WcoEmail::EmailFilter.new authorize! :new, @email_filter end def update @email_filter = WcoEmail::EmailFilter.find params[:id] authorize! :update, @email_filter flag = @email_filter.update_attributes( params[:email_filter].permit! ) if flag flash[:notice] = 'Success' else flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}." end redirect_to action: 'index' end ## ## private ## private def set_lists super @email_templates_list = WcoEmail::EmailTemplate.list @email_actions_list = WcoEmail::EmailAction.list @email_action_templates_list = WcoEmail::EmailActionTemplate.list end end
Version data entries
5 entries across 5 versions & 1 rubygems