Class: ActionController::UrlRewriter

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/url_rewriter.rb

Overview

Rewrites URLs for Base.redirect_to and Base.url_for in the controller.

Constant Summary collapse

RESERVED_OPTIONS =

:nodoc:

[:anchor, :params, :only_path, :host, :protocol, :port, :trailing_slash, :skip_relative_url_root]

Instance Method Summary collapse

Constructor Details

#initialize(request, parameters) ⇒ UrlRewriter

Returns a new instance of UrlRewriter.



157
158
159
# File 'lib/action_controller/url_rewriter.rb', line 157

def initialize(request, parameters)
  @request, @parameters = request, parameters
end

Instance Method Details

#rewrite(options = {}) ⇒ Object



161
162
163
# File 'lib/action_controller/url_rewriter.rb', line 161

def rewrite(options = {})
  rewrite_url(options)
end

#to_strObject Also known as: to_s



165
166
167
# File 'lib/action_controller/url_rewriter.rb', line 165

def to_str
  "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}"
end