Sha256: 3d914d26bf23ca3306de3d4688653fe3a23064aeb6651de9453a00efac6be4b6

Contents?: true

Size: 985 Bytes

Versions: 7

Compression:

Stored size: 985 Bytes

Contents

class Wco::ApplicationController < ActionController::Base
  include Wco::ApplicationHelper

  check_authorization

  before_action :current_profile

  def home
  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 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

7 entries across 7 versions & 1 rubygems

Version Path
wco_models-3.1.0.44 app/controllers/wco/application_controller.rb
wco_models-3.1.0.43 app/controllers/wco/application_controller.rb
wco_models-3.1.0.42 app/controllers/wco/application_controller.rb
wco_models-3.1.0.41 app/controllers/wco/application_controller.rb
wco_models-3.1.0.40 app/controllers/wco/application_controller.rb
wco_models-3.1.0.39 app/controllers/wco/application_controller.rb
wco_models-3.1.0.38 app/controllers/wco/application_controller.rb