Class: ActionController::UrlRewriter
- 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, :trailing_slash, :skip_relative_url_root]
Instance Method Summary collapse
-
#initialize(request, parameters) ⇒ UrlRewriter
constructor
A new instance of UrlRewriter.
- #rewrite(options = {}) ⇒ Object
- #to_str ⇒ Object (also: #to_s)
Constructor Details
#initialize(request, parameters) ⇒ UrlRewriter
Returns a new instance of UrlRewriter.
6 7 8 |
# File 'lib/action_controller/url_rewriter.rb', line 6 def initialize(request, parameters) @request, @parameters = request, parameters end |
Instance Method Details
#rewrite(options = {}) ⇒ Object
10 11 12 |
# File 'lib/action_controller/url_rewriter.rb', line 10 def rewrite( = {}) rewrite_url(rewrite_path(), ) end |
#to_str ⇒ Object Also known as: to_s
14 15 16 |
# File 'lib/action_controller/url_rewriter.rb', line 14 def to_str "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" end |