Sha256: a75015d7264bf023225a56caf6e3415204ef89d88071acf1bc40ea1f28753d27

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 Bytes

Contents

class Admin::BaseController < ActionController::Base

  include Typus::Authentication::const_get(Typus.authentication.to_s.classify)

  before_filter :reload_config_and_roles, :authenticate, :set_locale

  helper_method :admin_user, :current_role

  protected

  def reload_config_and_roles
    Typus.reload! if Rails.env.development?
  end

  def set_locale
    I18n.locale = if admin_user && admin_user.respond_to?(:locale)
      admin_user.locale
    else
      Typus::I18n.default_locale
    end
  end

  def zero_users
    Typus.user_class.count.zero?
  end

  def not_allowed
    render :text => "Not allowed!", :status => :unprocessable_entity
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typus-3.1.10 app/controllers/admin/base_controller.rb
typus-3.1.9 app/controllers/admin/base_controller.rb
typus-3.1.8 app/controllers/admin/base_controller.rb