diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 16:45:39 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 16:45:39 +0000 |
commit | 4f40b2d8fbcfb437a628a353eb281553fc840728 (patch) | |
tree | 67e6d5c4ccf2eabe7644e830122f721f747f60fa /actionpack/lib/action_controller/deprecated_redirects.rb | |
parent | 3ccea931fac2872ffb26014592c036b5d137655f (diff) | |
download | rails-4f40b2d8fbcfb437a628a353eb281553fc840728.tar.gz rails-4f40b2d8fbcfb437a628a353eb281553fc840728.tar.bz2 rails-4f40b2d8fbcfb437a628a353eb281553fc840728.zip |
Improved performance of test app req/sec with ~10% refactoring the render method #1823 [Stefan Kaes]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1915 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/deprecated_redirects.rb')
-rw-r--r-- | actionpack/lib/action_controller/deprecated_redirects.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/deprecated_redirects.rb b/actionpack/lib/action_controller/deprecated_redirects.rb new file mode 100644 index 0000000000..264ac8de82 --- /dev/null +++ b/actionpack/lib/action_controller/deprecated_redirects.rb @@ -0,0 +1,17 @@ +module ActionController + class Base + protected + # Deprecated in favor of calling redirect_to directly with the path. + def redirect_to_path(path) + redirect_to(path) + end + + # Deprecated in favor of calling redirect_to directly with the url. If the resource has moved permanently, it's possible to pass + # true as the second parameter and the browser will get "301 Moved Permanently" instead of "302 Found". This can also be done through + # just setting the headers["Status"] to "301 Moved Permanently" before using the redirect_to. + def redirect_to_url(url, permanently = false) + headers["Status"] = "301 Moved Permanently" if permanently + redirect_to(url) + end + end +end |