module Devise::Models
def self.config(mod, *accessors) #:nodoc:
inside the given class.
To add the class methods you need to have a module ClassMethods defined
3) And an instance method stretches.
which have higher priority than Devise.stretches;
2) Some class methods for your model Model.stretches and Model.stretches=
1) An accessor called Devise.stretches, which value is used by default;
The line above creates:
Devise::Models.config(Devise::Authenticatable, :stretches, 10)
Creates configuration values for Devise and for the given module.
def self.config(mod, *accessors) #:nodoc: class << mod; attr_accessor :available_configs; end mod.available_configs = accessors accessors.each do |accessor| mod.class_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{accessor} if defined?(@#{accessor}) @#{accessor} elsif superclass.respond_to?(:#{accessor}) superclass.#{accessor} else Devise.#{accessor} end end def #{accessor}=(value) @#{accessor} = value end METHOD end end