Sha256: 1db54e0ab461925b825a28a64d32706095836afb077ac8ae63fc5d33b3d78677

Contents?: true

Size: 1017 Bytes

Versions: 2

Compression:

Stored size: 1017 Bytes

Contents

module Clearance
  class Configuration
    attr_accessor :mailer_sender, :cookie_expiration, :password_strategy, :user_model

    def initialize
      @mailer_sender = 'reply@example.com'
      @cookie_expiration = lambda { 1.year.from_now.utc }
    end

    def user_model
      @user_model || ::User
    end
  end

  class << self
    attr_accessor :configuration
  end

  # Configure Clearance someplace sensible,
  # like config/initializers/clearance.rb
  #
  # If you want users to only be signed in during the current session
  # instead of being remembered, do this:
  #
  #   config.cookie_expiration = lambda { }
  #
  # @example
  #   Clearance.configure do |config|
  #     config.mailer_sender     = 'me@example.com'
  #     config.cookie_expiration = lambda { 2.weeks.from_now.utc }
  #     config.password_strategy = MyPasswordStrategy
  #     config.user_model        = MyNamespace::MyUser
  #   end
  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clearance-0.16.3 lib/clearance/configuration.rb
clearance-0.16.2 lib/clearance/configuration.rb