module Devise::Models

def self.check_fields!(klass)

def self.check_fields!(klass)
  failed_attributes = []
  instance = klass.new
  klass.devise_modules.each do |mod|
    constant = const_get(mod.to_s.classify)
    constant.required_fields(klass).each do |field|
      failed_attributes << field unless instance.respond_to?(field)
    end
  end
  if failed_attributes.any?
    fail Devise::Models::MissingAttribute.new(failed_attributes)
  end
end

def self.config(mod, *accessors) #:nodoc:

: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::Models::DatabaseAuthenticatable, :stretches)

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

def devise(*modules)


for a complete description on those values.
with specific values for this model. Please check your Devise initializer
You can also give any of the devise configuration values in form of a hash,

devise :database_authenticatable, :confirmable, :recoverable

Include the chosen devise modules in your model:
def devise(*modules)
  options = modules.extract_options!.dup
  selected_modules = modules.map(&:to_sym).uniq.sort_by do |s|
    Devise::ALL.index(s) || -1  # follow Devise::ALL order
  end
  devise_modules_hook! do
    include Devise::Orm
    include Devise::Models::Authenticatable
    selected_modules.each do |m|
      mod = Devise::Models.const_get(m.to_s.classify)
      if mod.const_defined?("ClassMethods")
        class_mod = mod.const_get("ClassMethods")
        extend class_mod
        if class_mod.respond_to?(:available_configs)
          available_configs = class_mod.available_configs
          available_configs.each do |config|
            next unless options.key?(config)
            send(:"#{config}=", options.delete(config))
          end
        end
      end
      include mod
    end
    self.devise_modules |= selected_modules
    options.each { |key, value| send(:"#{key}=", value) }
  end
end

def devise_modules_hook!

So your ORM can include devise compatibility stuff.
The hook which is called inside devise.
def devise_modules_hook!
  yield
end