diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 48ec81d8..c2fb0ab9 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -16,6 +16,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2. * deprecation * Move devise/shared/_links.erb to devise/_links.erb * Devise only supports Rails 3.1 forward + * Deprecated support for nested devise_for blocks == 2.0.0.rc diff --git a/Gemfile.lock b/Gemfile.lock index 7b2cf5f5..851d4aa5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM rack-openid (~> 1.3.1) orm_adapter (0.0.5) polyglot (0.3.3) - rack (1.4.0) + rack (1.4.1) rack-cache (1.1) rack (>= 0.4) rack-openid (1.3.1) diff --git a/lib/devise/rails/routes.rb b/lib/devise/rails/routes.rb index 4ad7f633..3b75fc42 100644 --- a/lib/devise/rails/routes.rb +++ b/lib/devise/rails/routes.rb @@ -208,7 +208,12 @@ module ActionDispatch::Routing routes = mapping.used_routes devise_scope mapping.name do - yield if block_given? + if block_given? + ActiveSupport::Deprecation.warn "Passing a block to devise_for is deprecated. " \ + "Please call devise_scope :#{mapping.name} do ... end with the block instead", caller + yield + end + with_devise_exclusive_scope mapping.fullpath, mapping.name, options do routes.each { |mod| send("devise_#{mod}", mapping, mapping.controllers) } end diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index 8e4fee02..9d14d282 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -435,12 +435,6 @@ class AuthenticationOthersTest < ActionController::IntegrationTest assert_not warden.authenticated?(:admin) end - test 'uses the mapping from nested devise_for call' do - sign_in_as_user :visit => "/devise_for/sign_in" - assert warden.authenticated?(:user) - assert_not warden.authenticated?(:admin) - end - test 'sign in with xml format returns xml response' do create_user post user_session_path(:format => 'xml'), :user => {:email => "user@test.com", :password => '123456'} diff --git a/test/rails_app/config/routes.rb b/test/rails_app/config/routes.rb index 8a4a6438..b54cd60e 100644 --- a/test/rails_app/config/routes.rb +++ b/test/rails_app/config/routes.rb @@ -12,9 +12,7 @@ Rails.application.routes.draw do resources :admins, :only => [:index] # Users scope - devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } do - match "/devise_for/sign_in", :to => "devise/sessions#new" - end + devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } as :user do match "/as/sign_in", :to => "devise/sessions#new"