Permalink
Browse files

Bring back relative_url_root but deprecate it

  • Loading branch information...
1 parent b75e2f3 commit 827efe1a087e30dd065eb563f09d69926f7b2330 @NZKoz NZKoz committed Jan 22, 2009
Showing with 17 additions and 0 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +9 −0 actionpack/lib/action_controller/request.rb
  3. +6 −0 actionpack/test/controller/cgi_test.rb
@@ -1,5 +1,7 @@
*2.2.3 (pending release)*
+* Backwards Compatibility: bring back Request#relative_url_root but deprecate it.
+
* Rationalise the session options to one hash, prevents rack or integration tests from seeing in correct defaults. [Koz]
* I18n: translate number_to_human_size. Add storage_units: [Bytes, KB, MB, GB, TB] to your translations. #1448 [Yaroslav Markin]
@@ -305,6 +305,15 @@ def standard_port
else 80
end
end
+
+ # Returns the value of ActionController::Base.relative_url_root. This method is
+ # deprecated as the value is an application wide setting, not something which
+ # changes per request.
+ def relative_url_root
+ ActiveSupport::Deprecation.warn(
+ "relative_url_root is now set application-wide, use ActionController::Base.relative_url_root instead.", caller)
+ ActionController::Base.relative_url_root
+ end
# Returns a \port suffix like ":8080" if the \port number of this request
# is not the default HTTP \port 80 or HTTPS \port 443.
@@ -161,6 +161,12 @@ def test_cookie_syntax_resilience
assert_equal ["c84ace847,96670c052c6ceb2451fb0f2"], alt_cookies["_session_id"], alt_cookies.inspect
assert_equal ["yes"], alt_cookies["is_admin"], alt_cookies.inspect
end
+
+ def test_relative_url_root
+ assert_deprecated("ActionController::Base.relative_url_root") do
+ assert_equal ActionController::Base.relative_url_root, @request.relative_url_root
+ end
+ end
end
class CgiRequestParamsParsingTest < BaseCgiTest

0 comments on commit 827efe1

Please sign in to comment.