1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Show a warning message in case routes are not mounted in the main app.

This commit is contained in:
José Valim 2012-02-07 10:56:30 +01:00
parent 7d09b84ded
commit dc37b82298
2 changed files with 11 additions and 1 deletions

View file

@ -221,7 +221,7 @@ module Devise
# to :main_app. Should be overriden by engines in order
# to provide custom routes.
mattr_accessor :router_name
@@router_name = :main_app
@@router_name = nil
# DEPRECATED CONFIG

View file

@ -1,3 +1,5 @@
require "active_support/core_ext/object/try"
module ActionDispatch::Routing
class RouteSet #:nodoc:
# Ensure Devise modules are included only after loading routes, because we
@ -6,6 +8,14 @@ module ActionDispatch::Routing
finalize_without_devise!
@devise_finalized ||= begin
if Devise.router_name.nil? && 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."
end
Devise.router_name ||= :main_app
Devise.configure_warden!
Devise.regenerate_helpers!
true