Module: Turbolinks::XHRUrlFor

Defined in:
lib/turbolinks/xhr_url_for.rb

Overview

Corrects the behavior of url_for (and link_to, which uses url_for) with the :back option by using the X-XHR-Referer request header instead of the standard Referer request header.

Instance Method Summary collapse

Instance Method Details

#url_for(options = {}) ⇒ Object



6
7
8
9
# File 'lib/turbolinks/xhr_url_for.rb', line 6

def url_for(options = {})
  options = (controller.request.headers["X-XHR-Referer"] || options) if options == :back
  super
end