From 421256d294c8a31122f38cae2ab11b5ccad74f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 1 Jul 2010 13:50:05 +0200 Subject: [PATCH] Devise should respect script_name and path_info contracts. This closes #331, a long standing bug with Passenger. --- lib/devise/controllers/internal_helpers.rb | 2 +- test/integration/authenticatable_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/devise/controllers/internal_helpers.rb b/lib/devise/controllers/internal_helpers.rb index 374db3d9..d1f3ee54 100644 --- a/lib/devise/controllers/internal_helpers.rb +++ b/lib/devise/controllers/internal_helpers.rb @@ -39,7 +39,7 @@ module Devise # Attempt to find the mapped route for devise based on request path def devise_mapping @devise_mapping ||= begin - mapping = Devise::Mapping.find_by_path(request.path) + mapping = Devise::Mapping.find_by_path(request.path_info) mapping ||= Devise.mappings[Devise.default_scope] if Devise.use_default_scope mapping end diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index de539fe9..37758f22 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -285,6 +285,13 @@ class AuthenticationWithScopesTest < ActionController::IntegrationTest assert_contain 'Sign in' end end + + test 'sign in with script name' do + assert_nothing_raised do + get new_user_session_path, {}, "SCRIPT_NAME" => "/omg" + fill_in "email", "user@test.com" + end + end end class AuthenticationOthersTest < ActionController::IntegrationTest