Module: Turbolinks::Redirection

Extended by:
ActiveSupport::Concern
Defined in:
lib/turbolinks/redirection.rb

Instance Method Summary collapse

Instance Method Details

#redirect_to(url = {}, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/turbolinks/redirection.rb', line 9

def redirect_to(url = {}, options = {})
  turbolinks = options.delete(:turbolinks)

  super.tap do
    if turbolinks != false && request.xhr? && !request.get?
      visit_location_with_turbolinks(location, turbolinks)
    else
      if request.headers["Turbolinks-Referrer"]
        store_turbolinks_location_in_session(location)
      end
    end
  end
end