Ticket #442: permanent_redirect.patch
| File permanent_redirect.patch, 0.7 kB (added by viktors.rotano..@gmail.com, 10 months ago) |
|---|
-
lib/merb/mixins/controller.rb
old new 64 64 # 65 65 # +url+ - URL to redirect to; it can be either a relative or 66 66 # fully-qualified URL. 67 # +permanent+ - Whether to use permanent redirection. 67 68 # 68 def redirect(url) 69 Merb.logger.info("Redirecting to: #{url}") 70 set_status(302) 69 def redirect(url, permanent = false) 70 status = permanent ? 301 : 302 71 Merb.logger.info("Redirecting to: #{url} status: #{status}") 72 set_status(status) 71 73 headers['Location'] = url 72 74 "<html><body>You are being <a href=\"#{url}\">redirected</a>.</body></html>" 73 75 end
