Permalink
Browse files

Detail loading process.

  • Loading branch information...
1 parent f00d29c commit a7e25f1b3960e1e338348a86c6ef37b8c241bb1a @josevalim josevalim committed Oct 21, 2009
Showing with 20 additions and 23 deletions.
  1. +1 −8 init.rb
  2. +11 −13 lib/devise.rb
  3. +8 −2 lib/devise/warden.rb
View
@@ -1,9 +1,2 @@
+# We need to load devise here to ensure routes extensions are loaded.
require 'devise'
-
-# Configures a preparation callback to include devise authenticable module and
-# view helpers (engines don't load helpers by default)
-#config.to_prepare do
-# ActionController::Base.send :include, Devise::Controllers::Authenticable
-# ActionView::Base.send :include, DeviseHelper
-## ApplicationController.helper(DeviseHelper)
-#end
View
@@ -1,10 +1,3 @@
-begin
- require 'warden'
-rescue
- gem 'warden'
- require 'warden'
-end
-
module Devise
ALL = [:authenticable, :confirmable, :recoverable, :rememberable, :validatable].freeze
@@ -38,13 +31,18 @@ def #{accessor}
end
end
-require 'devise/warden'
-require 'devise/routes'
-
-# Ensure to include Devise modules only after Rails initialization.
-# This way application should have already defined Devise mappings and we are
-# able to create default filters.
+# Devise initialization process goes like this:
+#
+# 1) Include Devise::ActiveRecord and Devise::Migrations
+# 2) Load and config warden
+# 3) Add routes extensions
+# 4) Load routes definitions
+# 5) Include filters and helpers in controllers and views
+#
Rails.configuration.after_initialize do
ActiveRecord::Base.extend Devise::ActiveRecord
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Devise::Migrations
end
+
+require 'devise/warden'
+require 'devise/routes'
View
@@ -1,5 +1,11 @@
-# Taken from RailsWarden, thanks to Hassox.
-# http://github.com/hassox/rails_warden
+begin
+ require 'warden'
+rescue
+ gem 'warden'
+ require 'warden'
+end
+
+# Taken from RailsWarden, thanks to Hassox. http://github.com/hassox/rails_warden
module Warden::Mixins::Common
# Gets the rails request object by default if it's available
def request

0 comments on commit a7e25f1

Please sign in to comment.