instance method redirection_proc

Ruby on Rails 3.1.12

Since v3.1.12 Last seen in v3.1.12 Private

Signature

redirection_proc(status, path_proc)

No documentation comment.

Parameters

status req
path_proc req
Source
# File actionpack/lib/action_dispatch/routing/redirection.rb, line 86
        def redirection_proc(status, path_proc)
          lambda do |env|
            req = Request.new(env)

            params = [req.symbolized_path_parameters]
            params << req if path_proc.arity > 1

            uri = URI.parse(path_proc.call(*params))
            uri.scheme ||= req.scheme
            uri.host   ||= req.host
            uri.port   ||= req.port unless req.standard_port?

            body = %(<html><body>You are being <a href="#{ERB::Util.h(uri.to_s)}">redirected</a>.</body></html>)

            headers = {
              'Location' => uri.to_s,
              'Content-Type' => 'text/html',
              'Content-Length' => body.length.to_s
            }

            [ status, headers, [body] ]
          end
        end

Defined in actionpack/lib/action_dispatch/routing/redirection.rb line 86 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Routing::Redirection

Type at least 2 characters to search.

↑↓ navigate · open · esc close