Permalink
Browse files

Fix regression where warden was being configured too early.

  • Loading branch information...
josevalim committed Feb 17, 2012
1 parent 9f4f973 commit 4c654e71be1e088ab920e4ad7b4079dbbaae147c
Showing with 4 additions and 8 deletions.
  1. +0 −2 lib/devise/rails.rb
  2. +4 −6 lib/devise/rails/routes.rb
View
@@ -87,8 +87,6 @@ def respond_to?(method, include_private = false)
end
config.after_initialize do
- Devise.configure_warden!
-
example = <<-YAML
en:
devise:
View
@@ -7,20 +7,18 @@ class RouteSet #:nodoc:
def finalize_with_devise!
result = finalize_without_devise!
- # If @devise_finalized was defined, it means devise_for was invoked
- # in this router, so we proceed to generate devise helpers unless
- # they were already defined (which then @devise_finalizd would be true).
- if defined?(@devise_finalized) && !@devise_finalized
- if Devise.router_name.nil? && self != Rails.application.try(:routes)
+ @devise_finalized ||= begin
+ if Devise.router_name.nil? && defined?(@devise_finalized) && self != Rails.application.try(:routes)
warn "[DEVISE] We have detected that you are using devise_for inside engine routes. " \
"In this case, you probably want to set Devise.router_name = MOUNT_POINT, where " \
"MOUNT_POINT is a symbol representing where this engine will be mounted at. For " \
"now Devise will default the mount point to :main_app. You can explicitly set it" \
" to :main_app as well in case you want to keep the current behavior."
end
+ Devise.configure_warden!
Devise.regenerate_helpers!
- @devise_finalized = true
+ true
end
result

0 comments on commit 4c654e7

Please sign in to comment.