Method: Authlogic::ActsAsAuthentic::Base::Config#add_acts_as_authentic_module

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

#add_acts_as_authentic_module(mod, action = :append) ⇒ Object

Since this part of Authlogic deals with another class, ActiveRecord, we can’t just start including things in ActiveRecord itself. A lot of these module includes need to be triggered by the acts_as_authentic method call. For example, you don’t want to start adding in email validations and what not into a model that has nothing to do with Authlogic.

That being said, this is your tool for extending Authlogic and “hooking” into the acts_as_authentic call.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/authlogic/acts_as_authentic/base.rb', line 43

def add_acts_as_authentic_module(mod, action = :append)
  modules = acts_as_authentic_modules
  case action
  when :append
    modules << mod
  when :prepend
    modules = [mod] + modules
  end
  modules.uniq!
  write_inheritable_attribute(:acts_as_authentic_modules, modules)
end