Method: Authlogic::ActsAsAuthentic::Base::Config#acts_as_authentic

Defined in:
lib/authlogic/acts_as_authentic/base.rb

#acts_as_authentic(unsupported_options = nil) {|_self| ... } ⇒ Object

This includes a lot of helpful methods for authenticating records which The Authlogic::Session module relies on. To use it just do:

class User < ActiveRecord::Base
  acts_as_authentic
end

Configuration is easy:

acts_as_authentic do |c|
  c.my_configuration_option = my_value
end

See the various sub modules for the configuration they provide.

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
33
34
35
# File 'lib/authlogic/acts_as_authentic/base.rb', line 26

def acts_as_authentic(unsupported_options = nil, &block)
  # Stop all configuration if the DB is not set up
  return if !db_setup?
  
  raise ArgumentError.new("You are using the old v1.X.X configuration method for Authlogic. Instead of " +
    "passing a hash of configuration options to acts_as_authentic, pass a block: acts_as_authentic { |c| c.my_option = my_value }") if !unsupported_options.nil?
  
  yield self if block_given?
  acts_as_authentic_modules.each { |mod| include mod }
end