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

Be more friendly if the user goes ahead and adds devise_for :users before defining the model.

This commit is contained in:
José Valim 2010-06-24 16:51:30 +02:00
parent ad63e25c89
commit 7a45043bc8
2 changed files with 7 additions and 2 deletions

View file

@ -93,6 +93,11 @@ module ActionDispatch::Routing
begin
raise_no_devise_method_error!(mapping.class_name) unless mapping.to.respond_to?(:devise)
rescue NameError => e
raise unless mapping.class_name == resource.to_s.classify
warn "[WARNING] You provided devise_for #{resource.inspect} but there is " <<
"no model #{mapping.class_name} defined in your application"
next
rescue NoMethodError => e
raise unless e.message.include?("undefined method `devise'")
raise_no_devise_method_error!(mapping.class_name)

View file

@ -7,8 +7,8 @@ Rails::Application.routes.draw do
devise_for :users
devise_for :admin, :path => "admin_area", :controllers => { :sessions => "sessions" }, :skip => :passwords
devise_for :accounts, :singular => "manager", :path_prefix => ":locale",
:class_name => "User", :path_names => {
devise_for :accounts, :singular => "manager", :path_prefix => ":locale", :class_name => "User",
:path_names => {
:sign_in => "login", :sign_out => "logout",
:password => "secret", :confirmation => "verification",
:unlock => "unblock", :sign_up => "register",