module Turbolinks::LegacyXHRUrlFor

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

Public Class Methods

included(base) click to toggle source
# File lib/turbolinks/xhr_url_for.rb, line 14
def self.included(base)
  base.alias_method_chain :url_for, :xhr_referer
end

Public Instance Methods

url_for_with_xhr_referer(options = {}) click to toggle source
# 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