Exception: Sidewalk::SeeOtherRedirect
Overview
Use if the resource hasn't moved, but you want to redirect anyway.
The new request will be a GET request.
Standard usage is to redirect after a POST, to make the browser's Refresh and back/forward buttons work as expected.
Defaults to a '303 See Other', but if you need to support pre-HTTP/1.1 browsers, you might want to change this.
Instance Attribute Summary
Attributes inherited from Redirect
Instance Method Summary (collapse)
-
- (Object) description(request)
Return an appropriate description.
-
- (SeeOtherRedirect) initialize(url)
constructor
A new instance of SeeOtherRedirect.
-
- (Object) status(request)
Return an appropriate status code.
Constructor Details
- (SeeOtherRedirect) initialize(url)
A new instance of SeeOtherRedirect
49 50 51 |
# File 'lib/sidewalk/redirect.rb', line 49 def initialize url super url, nil, nil end |
Instance Method Details
- (Object) description(request)
Return an appropriate description.
69 70 71 72 73 74 75 76 |
# File 'lib/sidewalk/redirect.rb', line 69 def description request case status(request) when 303 'See Other' when 302 'Found' end end |
- (Object) status(request)
Return an appropriate status code.
57 58 59 60 61 62 63 |
# File 'lib/sidewalk/redirect.rb', line 57 def status request if request.http_version == '1.1' 303 else 302 end end |