Sha256: 837e9e5bc2e346d22de966078cf60e6347085ac3b4c59f0ac54daf76d8a044f8

Contents?: true

Size: 872 Bytes

Versions: 7

Compression:

Stored size: 872 Bytes

Contents

module TheRole
  def self.configure(&block)
    yield @config ||= TheRole::Configuration.new
  end

  def self.config
    @config
  end

  # Configuration class
  class Configuration
    include ActiveSupport::Configurable
    config_accessor :layout,
                    :destroy_strategy,
                    :default_user_role,
                    :access_denied_method,
                    :login_required_method,
                    :first_user_should_be_admin
  end

  configure do |config|
    config.layout                     = :application

    config.default_user_role          = nil
    config.first_user_should_be_admin = false
    config.access_denied_method       = :access_denied
    config.login_required_method      = :authenticate_user!
    config.destroy_strategy           = :restrict_with_exception # can be nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
the_role-2.5.4 lib/the_role/config.rb
the_role-2.5.3 lib/the_role/config.rb
the_role-2.5.2 lib/the_role/config.rb
the_role-2.5.1 lib/the_role/config.rb
the_role-2.5 lib/the_role/config.rb
the_role-2.4 lib/the_role/config.rb
the_role-2.3 lib/the_role/config.rb