Class: ActionDispatch::Routing::OptionRedirect

Inherits:
Redirect show all
Defined in:
actionpack/lib/action_dispatch/routing/redirection.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Redirect

#block, #status

Instance Method Summary collapse

Methods inherited from Redirect

#call, #initialize

Constructor Details

This class inherits a constructor from ActionDispatch::Routing::Redirect

Instance Method Details

#path(params, request) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'actionpack/lib/action_dispatch/routing/redirection.rb', line 42

def path(params, request)
  url_options = {
    :protocol => request.protocol,
    :host     => request.host,
    :port     => request.optional_port,
    :path     => request.path,
    :params   => request.query_parameters
  }.merge options

  if !params.empty? && url_options[:path].match(/%\{\w*\}/)
    url_options[:path] = (url_options[:path] % escape_path(params))
  end

  ActionDispatch::Http::URL.url_for url_options
end