Skip to content

Commit

Permalink
Bring back relative_url_root but deprecate it
Browse files Browse the repository at this point in the history
  • Loading branch information
NZKoz committed Jan 22, 2009
1 parent b75e2f3 commit 827efe1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
9 changes: 9 additions & 0 deletions actionpack/lib/action_controller/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/controller/cgi_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 827efe1

Please sign in to comment.