From 2e1a27fa4de4460808405bdb7771ae2c59b99dd1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 31 Dec 2004 17:04:15 +0000 Subject: Added second boolean parameter to Base.redirect_to_url and Response#redirect to control whether the redirect is permanent or not (301 vs 302) #375 [Hodel] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@293 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/response.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller/response.rb') diff --git a/actionpack/lib/action_controller/response.rb b/actionpack/lib/action_controller/response.rb index 836dd5ffef..a574fbca75 100755 --- a/actionpack/lib/action_controller/response.rb +++ b/actionpack/lib/action_controller/response.rb @@ -7,8 +7,8 @@ module ActionController @body, @headers, @session, @assigns = "", DEFAULT_HEADERS.merge("cookie" => []), [], [] end - def redirect(to_url) - @headers["Status"] = "302 Moved" + def redirect(to_url, permanently = false) + @headers["Status"] = permanently ? "301 Moved Permanently" : "302 Found" @headers["location"] = to_url end end -- cgit v1.2.3