Sha256: e7f868ca06e5e45048f9e548c7f64d6cc83c5b00c57226da22188603a2339b65

Contents?: true

Size: 1.41 KB

Versions: 64

Compression:

Stored size: 1.41 KB

Contents

class ::IshManager::EmailFiltersController < ::IshManager::ApplicationController

  before_action :set_lists

  # alphabetized : )

  def create
    authorize! :create, Office::EmailFilter
    @email_filter = Office::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 = Office::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 = Office::EmailFilter.find params[:id]
    authorize! :edit, @email_filter
  end

  def index
    authorize! :index, Office::EmailFilter.new
    @email_filters = Office::EmailFilter.active
  end

  def new
    @email_filter = Office::EmailFilter.new
    authorize! :new, @email_filter
  end

  def update
    @email_filter = Office::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

end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
ish_manager-0.1.8.443 app/controllers/ish_manager/email_filters_controller.rb
ish_manager-0.1.8.442 app/controllers/ish_manager/email_filters_controller.rb
ish_manager-0.1.8.441 app/controllers/ish_manager/email_filters_controller.rb
ish_manager-0.1.8.440 app/controllers/ish_manager/email_filters_controller.rb