Sha256: 9fbff844983a30f5ed3c7b500353ceb874991173cc103146a84ea201155fbe25

Contents?: true

Size: 1.63 KB

Versions: 29

Compression:

Stored size: 1.63 KB

Contents

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

  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

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
wco_models-3.1.0.146 app/controllers/wco/application_controller.rb
wco_models-3.1.0.145 app/controllers/wco/application_controller.rb
wco_models-3.1.0.144 app/controllers/wco/application_controller.rb
wco_models-3.1.0.143 app/controllers/wco/application_controller.rb
wco_models-3.1.0.142 app/controllers/wco/application_controller.rb
wco_models-3.1.0.141 app/controllers/wco/application_controller.rb
wco_models-3.1.0.140 app/controllers/wco/application_controller.rb
wco_models-3.1.0.139 app/controllers/wco/application_controller.rb
wco_models-3.1.0.138 app/controllers/wco/application_controller.rb
wco_models-3.1.0.137 app/controllers/wco/application_controller.rb
wco_models-3.1.0.136 app/controllers/wco/application_controller.rb
wco_models-3.1.0.135 app/controllers/wco/application_controller.rb
wco_models-3.1.0.134 app/controllers/wco/application_controller.rb
wco_models-3.1.0.133 app/controllers/wco/application_controller.rb
wco_models-3.1.0.132 app/controllers/wco/application_controller.rb
wco_models-3.1.0.131 app/controllers/wco/application_controller.rb
wco_models-3.1.0.130 app/controllers/wco/application_controller.rb
wco_models-3.1.0.129 app/controllers/wco/application_controller.rb
wco_models-3.1.0.128 app/controllers/wco/application_controller.rb
wco_models-3.1.0.127 app/controllers/wco/application_controller.rb