lib/devise/rails/routes.rb in devise-3.2.2 vs lib/devise/rails/routes.rb in devise-3.2.3

- old
+ new

@@ -100,12 +100,15 @@ # devise_for :users, :singular => :user # # * :path_names => configure different path names to overwrite defaults :sign_in, :sign_out, :sign_up, # :password, :confirmation, :unlock. # - # devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout', - # :password => 'secret', :confirmation => 'verification', registration: 'register } + # devise_for :users, path_names: { + # sign_in: 'login', sign_out: 'logout', + # password: 'secret', confirmation: 'verification', + # registration: 'register', edit: 'edit/profile' + # } # # * :controllers => the controller which should be used. All routes by default points to Devise controllers. # However, if you want them to point to custom controller, you should do: # # devise_for :users, :controllers => { :sessions => "users/sessions" } @@ -227,10 +230,18 @@ rescue NoMethodError => e raise unless e.message.include?("undefined method `devise'") raise_no_devise_method_error!(mapping.class_name) end + if options[:controllers] && options[:controllers][:omniauth_callbacks] + unless mapping.omniauthable? + msg = "Mapping omniauth_callbacks on a resource that is not omniauthable\n" + msg << "Please add `devise :omniauthable` to the `#{mapping.class_name}` model" + raise msg + end + end + routes = mapping.used_routes devise_scope mapping.name do with_devise_exclusive_scope mapping.fullpath, mapping.name, options do routes.each { |mod| send("devise_#{mod}", mapping, mapping.controllers) } @@ -368,10 +379,11 @@ end def devise_registration(mapping, controllers) #:nodoc: path_names = { :new => mapping.path_names[:sign_up], + :edit => mapping.path_names[:edit], :cancel => mapping.path_names[:cancel] } options = { :only => [:new, :create, :edit, :update, :destroy], @@ -391,16 +403,16 @@ Devise does not support scoping omniauth callbacks under a dynamic segment and you have set #{mapping.fullpath.inspect}. You can work around by passing `skip: :omniauth_callbacks` and manually defining the routes. Here is an example: match "/users/auth/:provider", - :constraints => { :provider => /\A(google|facebook)\z/ }, + :constraints => { :provider => /google|facebook/ }, :to => "devise/omniauth_callbacks#passthru", :as => :omniauth_authorize, :via => [:get, :post] match "/users/auth/:action/callback", - :constraints => { :action => /\A(google|facebook)\z/ }, + :constraints => { :action => /google|facebook/ }, :to => "devise/omniauth_callbacks", :as => :omniauth_callback, :via => [:get, :post] ERROR end