aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorHrvoje Šimić <shime@twobucks.co>2017-03-12 17:51:26 +0100
committerHrvoje Šimić <shime@twobucks.co>2017-03-13 17:05:12 +0100
commit1c6747999a74eac84d4e30d698f59c16e0309d64 (patch)
tree7830468ac8038636c75a0125925b4635b175b3fe /actionpack/lib/action_dispatch/routing/mapper.rb
parent4d5060072b5446e0d13873f7edbecaf3527e7846 (diff)
downloadrails-1c6747999a74eac84d4e30d698f59c16e0309d64.tar.gz
rails-1c6747999a74eac84d4e30d698f59c16e0309d64.tar.bz2
rails-1c6747999a74eac84d4e30d698f59c16e0309d64.zip
[docs] fix ActionDispatch documentation
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb50
1 files changed, 25 insertions, 25 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index dea6c4482e..8ad17504ae 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -17,9 +17,9 @@ module ActionDispatch
CALL = ->(app, req) { app.call req.env }
def initialize(app, constraints, strategy)
- # Unwrap Constraints objects. I don't actually think it's possible
+ # Unwrap Constraints objects. I don't actually think it's possible
# to pass a Constraints object to this constructor, but there were
- # multiple places that kept testing children of this object. I
+ # multiple places that kept testing children of this object. I
# *think* they were just being defensive, but I have no idea.
if app.is_a?(self.class)
constraints += app.constraints
@@ -218,7 +218,7 @@ module ActionDispatch
private
def add_wildcard_options(options, formatted, path_ast)
# Add a constraint for wildcard route to make it non-greedy and match the
- # optional format part of the route by default
+ # optional format part of the route by default.
if formatted != false
path_ast.grep(Journey::Nodes::Star).each_with_object({}) { |node, hash|
hash[node.name.to_sym] ||= /.+?/
@@ -396,7 +396,7 @@ module ActionDispatch
end
module Base
- # Matches a url pattern to one or more routes.
+ # Matches a URL pattern to one or more routes.
#
# You should not use the +match+ method in your router
# without specifying an HTTP method.
@@ -406,7 +406,7 @@ module ActionDispatch
# # sets :controller, :action and :id in params
# match ':controller/:action/:id', via: [:get, :post]
#
- # Note that +:controller+, +:action+ and +:id+ are interpreted as url
+ # Note that +:controller+, +:action+ and +:id+ are interpreted as URL
# query parameters and thus available through +params+ in an action.
#
# If you want to expose your action to GET, use +get+ in the router:
@@ -455,7 +455,7 @@ module ActionDispatch
#
# === Options
#
- # Any options not seen here are passed on as params with the url.
+ # Any options not seen here are passed on as params with the URL.
#
# [:controller]
# The route's controller.
@@ -660,7 +660,7 @@ module ActionDispatch
else
prefix_options = options.slice(*_route.segment_keys)
prefix_options[:relative_url_root] = "".freeze
- # we must actually delete prefix segment keys to avoid passing them to next url_for
+ # We must actually delete prefix segment keys to avoid passing them to next url_for.
_route.segment_keys.each { |k| options.delete(k) }
_routes.url_helpers.send("#{name}_path", prefix_options)
end
@@ -1238,7 +1238,7 @@ module ActionDispatch
#
# resource :profile
#
- # creates six different routes in your application, all mapping to
+ # This creates six different routes in your application, all mapping to
# the +Profiles+ controller (note that the controller is named after
# the plural):
#
@@ -1323,14 +1323,14 @@ module ActionDispatch
#
# resources :posts, path_names: { new: "brand_new" }
#
- # The above example will now change /posts/new to /posts/brand_new
+ # The above example will now change /posts/new to /posts/brand_new.
#
# [:path]
# Allows you to change the path prefix for the resource.
#
# resources :posts, path: 'postings'
#
- # The resource and all segments will now route to /postings instead of /posts
+ # The resource and all segments will now route to /postings instead of /posts.
#
# [:only]
# Only generate routes for the given actions.
@@ -1525,7 +1525,7 @@ module ActionDispatch
end
end
- # See ActionDispatch::Routing::Mapper::Scoping#namespace
+ # See ActionDispatch::Routing::Mapper::Scoping#namespace.
def namespace(path, options = {})
if resource_scope?
nested { super }
@@ -1545,7 +1545,7 @@ module ActionDispatch
!parent_resource.singleton? && @scope[:shallow]
end
- # Matches a url pattern to one or more routes.
+ # Matches a URL pattern to one or more routes.
# For more information, see match[rdoc-ref:Base#match].
#
# match 'path' => 'controller#action', via: patch
@@ -2003,7 +2003,7 @@ module ActionDispatch
# concerns :commentable
# end
#
- # concerns also work in any routes helper that you want to use:
+ # Concerns also work in any routes helper that you want to use:
#
# namespace :posts do
# concerns :commentable
@@ -2038,33 +2038,33 @@ module ActionDispatch
# end
#
# The return value from the block passed to `direct` must be a valid set of
- # arguments for `url_for` which will actually build the url string. This can
+ # arguments for `url_for` which will actually build the URL string. This can
# be one of the following:
#
- # * A string, which is treated as a generated url
+ # * A string, which is treated as a generated URL
# * A hash, e.g. { controller: "pages", action: "index" }
# * An array, which is passed to `polymorphic_url`
# * An Active Model instance
# * An Active Model class
#
- # NOTE: Other url helpers can be called in the block but be careful not to invoke
- # your custom url helper again otherwise it will result in a stack overflow error
+ # NOTE: Other URL helpers can be called in the block but be careful not to invoke
+ # your custom URL helper again otherwise it will result in a stack overflow error.
#
# You can also specify default options that will be passed through to
- # your url helper definition, e.g:
+ # your URL helper definition, e.g:
#
# direct :browse, page: 1, size: 10 do |options|
# [ :products, options.merge(params.permit(:page, :size).to_h.symbolize_keys) ]
# end
#
# In this instance the `params` object comes from the context in which the the
- # block is executed, e.g. generating a url inside a controller action or a view.
+ # block is executed, e.g. generating a URL inside a controller action or a view.
# If the block is executed where there isn't a params object such as this:
#
# Rails.application.routes.url_helpers.browse_path
#
# then it will raise a `NameError`. Because of this you need to be aware of the
- # context in which you will use your custom url helper when defining it.
+ # context in which you will use your custom URL helper when defining it.
#
# NOTE: The `direct` method can't be used inside of a scope block such as
# `namespace` or `scope` and will raise an error if it detects that it is.
@@ -2076,7 +2076,7 @@ module ActionDispatch
@set.add_url_helper(name, options, &block)
end
- # Define custom polymorphic mappings of models to urls. This alters the
+ # Define custom polymorphic mappings of models to URLs. This alters the
# behavior of `polymorphic_url` and consequently the behavior of
# `link_to` and `form_for` when passed a model instance, e.g:
#
@@ -2089,7 +2089,7 @@ module ActionDispatch
# This will now generate "/basket" when a `Basket` instance is passed to
# `link_to` or `form_for` instead of the standard "/baskets/:id".
#
- # NOTE: This custom behavior only applies to simple polymorphic urls where
+ # NOTE: This custom behavior only applies to simple polymorphic URLs where
# a single model instance is passed and not more complicated forms, e.g:
#
# # config/routes.rb
@@ -2105,7 +2105,7 @@ module ActionDispatch
# link_to "Profile", [:admin, @current_user]
#
# The first `link_to` will generate "/profile" but the second will generate
- # the standard polymorphic url of "/admin/users/1".
+ # the standard polymorphic URL of "/admin/users/1".
#
# You can pass options to a polymorphic mapping - the arity for the block
# needs to be two as the instance is passed as the first argument, e.g:
@@ -2114,9 +2114,9 @@ module ActionDispatch
# [:basket, options]
# end
#
- # This generates the url "/basket#items" because when the last item in an
+ # This generates the URL "/basket#items" because when the last item in an
# array passed to `polymorphic_url` is a hash then it's treated as options
- # to the url helper that gets called.
+ # to the URL helper that gets called.
#
# NOTE: The `resolve` method can't be used inside of a scope block such as
# `namespace` or `scope` and will raise an error if it detects that it is.