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, :port, :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.
167 168 169 |
# File 'lib/action_controller/url_rewriter.rb', line 167 def initialize(request, parameters) @request, @parameters = request, parameters end |
Instance Method Details
#rewrite(options = {}) ⇒ Object
171 172 173 174 175 176 |
# File 'lib/action_controller/url_rewriter.rb', line 171 def rewrite( = {}) if .include?(:overwrite_params) ActiveSupport::Deprecation.warn 'The :overwrite_params option is deprecated. Specify all the necessary parameters instead', caller end rewrite_url() end |
#to_str ⇒ Object Also known as: to_s
178 179 180 |
# File 'lib/action_controller/url_rewriter.rb', line 178 def to_str "#{@request.protocol}, #{@request.host_with_port}, #{@request.path}, #{@parameters[:controller]}, #{@parameters[:action]}, #{@request.parameters.inspect}" end |