module Challah

Constants

VERSION

Public Class Methods

include_user_plugins!() click to toggle source

Loop through all registered plugins and extend User functionality.

# File lib/challah/plugins.rb, line 43
def self.include_user_plugins!
  Challah.plugins.values.each do |plugin|
    plugin.user_extensions.each do |mod|
      Challah.user.send(:extend, mod)
    end

    plugin.user_init_methods.each do |method_name|
      Challah.user.send(method_name)
    end
  end
end
options() click to toggle source

Configuration options Get or set options for the current Challah instance. In most cases these should be changed within a config/initializers/ file in your app.

@param [Hash] options The options to get or set @option options [String] :cookie_prefix (“challah”) A prefix to put in the names of the cookies that will be set. @option options [String] :access_denied_view (“challah/sessions/access_denied”)Relative path to the view that will be used to show access denied method. @option options [Class] :storage_class (SimpleCookieStore) The class to use for persistence of sessions. @option options [Boolean] :skip_routes (false) Pass in true to not add any routes into your Rails app by default. @option options [String] :email_validator (“challah/email”) Pass in a string name of the class to use for email validation. Class should inherit from ActiveModel::EachValidator @option options [Class] :password_validator (Challah::PasswordValidator) Pass in a class to use for password validation.

# File lib/challah.rb, line 48
def self.options
  @options ||= {
    access_denied_view:     "sessions/access_denied",
    api_key_enabled:        false,
    token_enabled:          false,
    token_header:           "X-Auth-Token",
    cookie_prefix:          "challah",
    email_validator:        "challah/email",
    password_validator:     PasswordValidator,
    skip_routes:            false,
    skip_user_validations:  false,
    storage_class:          SimpleCookieStore,
    user:                   :User
  }
end
user() click to toggle source
# File lib/challah.rb, line 64
def self.user
  options[:user].to_s.safe_constantize
end