aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/deprecated_redirects.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/deprecated_redirects.rb')
-rw-r--r--actionpack/lib/action_controller/deprecated_redirects.rb17
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