Skip to content
This repository
Browse code

Use get in the redirection doc examples

get is the most common usage, and match without an explicit verb
was disallowed in 56cdc81.

[ci skip]
  • Loading branch information...
commit 38411b89fc6b1ddf29a39fed174b8b7dd0951764 1 parent 42cfacf
Carlos Antonio da Silva carlosantoniodasilva authored

Showing 1 changed file with 7 additions and 7 deletions. Show diff stats Hide diff stats

  1. +7 7 actionpack/lib/action_dispatch/routing/redirection.rb
14 actionpack/lib/action_dispatch/routing/redirection.rb
@@ -98,11 +98,11 @@ module Redirection
98 98
99 99 # Redirect any path to another path:
100 100 #
101   - # match "/stories" => redirect("/posts")
  101 + # get "/stories" => redirect("/posts")
102 102 #
103 103 # You can also use interpolation in the supplied redirect argument:
104 104 #
105   - # match 'docs/:article', to: redirect('/wiki/%{article}')
  105 + # get 'docs/:article', to: redirect('/wiki/%{article}')
106 106 #
107 107 # Alternatively you can use one of the other syntaxes:
108 108 #
@@ -111,25 +111,25 @@ module Redirection
111 111 # params, depending of how many arguments your block accepts. A string is required as a
112 112 # return value.
113 113 #
114   - # match 'jokes/:number', to: redirect { |params, request|
  114 + # get 'jokes/:number', to: redirect { |params, request|
115 115 # path = (params[:number].to_i.even? ? "wheres-the-beef" : "i-love-lamp")
116 116 # "http://#{request.host_with_port}/#{path}"
117 117 # }
118 118 #
119 119 # Note that the +do end+ syntax for the redirect block wouldn't work, as Ruby would pass
120   - # the block to +match+ instead of +redirect+. Use <tt>{ ... }</tt> instead.
  120 + # the block to +get+ instead of +redirect+. Use <tt>{ ... }</tt> instead.
121 121 #
122 122 # The options version of redirect allows you to supply only the parts of the url which need
123 123 # to change, it also supports interpolation of the path similar to the first example.
124 124 #
125   - # match 'stores/:name', to: redirect(subdomain: 'stores', path: '/%{name}')
126   - # match 'stores/:name(*all)', to: redirect(subdomain: 'stores', path: '/%{name}%{all}')
  125 + # get 'stores/:name', to: redirect(subdomain: 'stores', path: '/%{name}')
  126 + # get 'stores/:name(*all)', to: redirect(subdomain: 'stores', path: '/%{name}%{all}')
127 127 #
128 128 # Finally, an object which responds to call can be supplied to redirect, allowing you to reuse
129 129 # common redirect routes. The call method must accept two arguments, params and request, and return
130 130 # a string.
131 131 #
132   - # match 'accounts/:name' => redirect(SubdomainRedirector.new('api'))
  132 + # get 'accounts/:name' => redirect(SubdomainRedirector.new('api'))
133 133 #
134 134 def redirect(*args, &block)
135 135 options = args.extract_options!

0 comments on commit 38411b8

Please sign in to comment.
Something went wrong with that request. Please try again.