mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
98ed2406f7
previously, if you specify a url parameter that is part of the path as false it would include that part of the path as parameter at the end of the url instead of in the path for example: `get "(/optional/:optional_id)/things" => "foo#foo", as: :things` `things_path(optional_id: false) # => /things?optional_id=false` this is not the case for empty string, `things_path(optional_id: '') # => "/things" this is due to a quark in how path parameters get removed from the parameters. we where doing `(paramter || recall).nil?` which returns nil if both values are nil however it also return nil if one value is false and the other value is nil. i.e. `(false || nil).nil # => nil` which is confusing. After this change, `true` and `false` will be treated the same when used as optional path parameters. meaning now, ``` get '(this/:my_bool)/that' as: :that that_path(my_bool: true) # => `/this/true/that` that_path(my_bool: false) # => `/this/false/that` ``` fixes: https://github.com/rails/rails/issues/42280 Co-authored-by: Ryuta Kamizono <kamipo@gmail.com> |
||
---|---|---|
.. | ||
gtg | ||
nfa | ||
nodes | ||
path | ||
router | ||
visualizer | ||
formatter.rb | ||
parser.rb | ||
parser.y | ||
parser_extras.rb | ||
route.rb | ||
router.rb | ||
routes.rb | ||
scanner.rb | ||
visitors.rb |