Module: Breezy::XHRHeaders
- Included in:
- Controller
- Defined in:
- lib/breezy/xhr_headers.rb
Instance Method Summary collapse
- #_compute_redirect_to_location(request, options) ⇒ Object
- #redirect_back(fallback_location:, **args) ⇒ Object
Instance Method Details
#_compute_redirect_to_location(request, options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/breezy/xhr_headers.rb', line 11 def _compute_redirect_to_location(request, ) url = begin if == :back && request.headers["X-XHR-Referer"] super(request, request.headers["X-XHR-Referer"]) else super end end if request.xhr? && request.headers["X-BREEZY-REQUEST"] self.status = 200 response.headers["X-BREEZY-LOCATION"] = url end url end |
#redirect_back(fallback_location:, **args) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/breezy/xhr_headers.rb', line 3 def redirect_back(fallback_location:, **args) if referer = request.headers["X-XHR-Referer"] redirect_to referer, **args else super end end |