Module: Turbolinks::LegacyXHRUrlFor

Defined in:
lib/turbolinks/xhr_url_for.rb

Overview

TODO: Remove me when support for Ruby < 2 && Rails < 4 is dropped

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
# File 'lib/turbolinks/xhr_url_for.rb', line 14

def self.included(base)
  base.alias_method_chain :url_for, :xhr_referer
end

Instance Method Details

#url_for_with_xhr_referer(options = {}) ⇒ Object



18
19
20
21
# File 'lib/turbolinks/xhr_url_for.rb', line 18

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