Sha256: 32e210ddf81f3c2da04c237c667bdaffff02450353cf9601d552210958ce77ad

Contents?: true

Size: 1.74 KB

Versions: 40

Compression:

Stored size: 1.74 KB

Contents

require_relative '../../../lib/shortcuts'
# EC   ||= WcoEmail::Conversation
# EF   ||= WcoEmail::EmailFilter
# EM   ||= WcoEmail::Message
# ET   ||= WcoEmail::EmailTemplate
# MS   ||= WcoEmail::MessageStub
# EMS  ||= MS
# OA   ||= Wco::OfficeAction
# OAT  ||= Wco::OfficeActionTemplate
# OATT ||= Wco::OfficeActionTemplateTie
# Sch  ||= WcoEmail::EmailAction

class Wco::ApplicationController < ActionController::Base
  include Wco::ApplicationHelper
  rescue_from Exception, with: :exception_notifier if Rails.env.production?

  check_authorization

  before_action :current_profile
  before_action :set_lists

  def home
    authorize! :home, Wco
  end

  def tinymce
    authorize! :home, Wco
    render layout: false
  end


  ##
  ## private
  ##
  private

  # def current_ability
  #   @current_ability ||= Ability.new(current_user)
  # end

  def current_profile
    @current_profile ||= Wco::Profile.find_by( email: current_user.email )
  end

  def current_leadset
    @current_leadset ||= current_profile.leadset
  end

  def exception_notifier(exc)
    puts! exc, "wco_models custom Exception"
    ::ExceptionNotifier.notify_exception(
      exc,
      data: {
        backtrace: exc.backtrace,
      }
    )
    raise exc
  end

  def flash_alert what
    flash[:alert] ||= []
    if String == what.class
      str = what
    else
      str = "Cannot create/update #{what.class.name}: #{what.errors.full_messages.join(', ')} ."
    end
    flash[:alert] << str
  end

  def flash_notice what
    flash[:notice] ||= []
    if String == what.class
      str = what
    else
      str = "Created/updated #{what.class.name} ."
    end
    flash[:notice] << str
  end

  def my_truthy? which
    ["1", "t", "T", "true"].include?( which )
  end

  def set_lists
  end

end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
wco_models-3.1.0.202 app/controllers/wco/application_controller.rb
wco_models-3.1.0.201 app/controllers/wco/application_controller.rb
wco_models-3.1.0.199 app/controllers/wco/application_controller.rb
wco_models-3.1.0.198 app/controllers/wco/application_controller.rb
wco_models-3.1.0.197 app/controllers/wco/application_controller.rb
wco_models-3.1.0.196 app/controllers/wco/application_controller.rb
wco_models-3.1.0.195 app/controllers/wco/application_controller.rb
wco_models-3.1.0.194 app/controllers/wco/application_controller.rb
wco_models-3.1.0.193 app/controllers/wco/application_controller.rb
wco_models-3.1.0.192 app/controllers/wco/application_controller.rb
wco_models-3.1.0.191 app/controllers/wco/application_controller.rb
wco_models-3.1.0.190 app/controllers/wco/application_controller.rb
wco_models-3.1.0.189 app/controllers/wco/application_controller.rb
wco_models-3.1.0.188 app/controllers/wco/application_controller.rb
wco_models-3.1.0.187 app/controllers/wco/application_controller.rb
wco_models-3.1.0.184 app/controllers/wco/application_controller.rb
wco_models-3.1.0.183 app/controllers/wco/application_controller.rb
wco_models-3.1.0.182 app/controllers/wco/application_controller.rb
wco_models-3.1.0.181 app/controllers/wco/application_controller.rb
wco_models-3.1.0.180 app/controllers/wco/application_controller.rb