| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
`Dispatcher` doesn't need to hold on to the defaults hash. It only used
the hash to determine whether or not it should raise an exception if
there is a name error. We can pass that in further up the stack and
alleviate Dispatcher from knowing about that hash.
|
|
|
|
|
|
| |
We know in advance whether the object is a dispatcher or not, so we can
configure the Constraints object with a strategy that will call the
right method.
|
|
|
|
| |
it isn't used.
|
|
|
|
|
|
|
|
|
|
|
| |
Add descriptions about `ActiveRecord::Base#to_param` to
* `ActionDispatch::Routing::Base#match`
* Overriding Named Route Parameters (guide)
When passes `:param` to route definision, always `to_param` method of
related model is overridden to constructe an URL by passing these
model instance to named_helper.
|
|
|
|
|
|
|
| |
The `dup` was introduced by c4106d0c08954b0761726e0015ec601b7bc7ea4b
to work around a frozen key. Nowadays, the string is already being
duplicated by the `tr` in `options[:action] ||= action.tr('-', '_')`
and later joined into a new string in `name_for_action`.
|
| |
|
|
|
|
|
|
| |
match method without setting `:via` option has been deprecated
fix minor typo
|
| |
|
| |
|
|\
| |
| | |
A shorter and more concise version of select..size
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Shorthand route match is when controller and action are taken literally from path.
E.g.
get '/foo/bar' # => will use 'foo#bar' as endpoint
get '/foo/bar/baz' # => will use 'foo/bar#baz' as endpoint
Not any path with level two or more of nesting can be used as shortcut.
If path contains any characters outside of /[\w-]/ then it can't be
used as such.
This commit ensures that invalid shortcuts aren't used.
':controller/:action/postfix' - is an example of invalid shortcut
that was previosly matched and led to exception:
"ArgumentError - ':controller/:action' is not a supported controller name"
|
| | |
|
| |
| |
| |
| | |
These requires were added only to change deprecation message
|
| |
| |
| |
| | |
doesn't contain `#`
|
| |
| |
| |
| | |
Also avoid using try since is_a? is faster for this case.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fixes a regression in 4.2.0 from 4.1.8.
https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value.
With a route like:
Rails.application.routes.draw do
mount Mountable::Web, at: 'some_route'
end
The "Prefix" column of rake routes gives the following:
- 4.1.8: mountable_web
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1: [nothing]
- 4.2.0.rc2: some_route <- regression
This fixes the default to go back to being based off the name of the class like the docs specify: https://github.com/rails/rails/blob/785d04e3109f69d0b9b9f4732179592f0ef04e52/actionpack/lib/action_dispatch/routing/mapper.rb#L558-L560
Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823:
Rails.application.routes.draw do
mount Mountable::Web, at: 'some_route', as: 'named'
end
- 4.1.8: named
- 4.2.0.beta1-4: [nothing]
- 4.2.0.rc1: [nothing]
- 4.2.0.rc2: named
|
| |
| |
| |
| | |
See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492
|
| | |
|
| |
| |
| |
| | |
[ci skip]
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch uniformizes warning messages. I used the most common style
already present in the code base:
* Capitalize the first word.
* End the message with a full stop.
* "Rails 5" instead of "Rails 5.0".
* Backticks for method names and inline code.
Also, converted a few long strings into the new heredoc convention.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
https://github.com/rails/rails/commit/402c2af55053c2f29319091ad21fd6fa6b90ee89
introduced a regression that caused any constraints added to redirect routes
to be ignored.
Fixes #16605
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
this will help us to encapsulate magical symbols so hopefully we can
eliminate hardcoded magic symbols
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
now we don't have to have a hard coded key
|
| |
| |
| |
| | |
avoid hash lookups and remove depency on the instance
|
| |
| |
| |
| | |
we don't need to repeat if statements
|
| |
| |
| |
| |
| | |
now we only have to look up @scope[:scope_level] once per call to
canonical_action? and we don't have a variable named "flag"
|
| |
| |
| |
| |
| | |
since we pass `as` down, then we won't have to do an insert / delete
dance with the options hash
|
| |
| |
| |
| | |
this allows us to avoid nil checks on the return value
|
| | |
|
| |
| |
| |
| |
| | |
there's no reason to to_sym the string if it doesn't match the regexp
anyway
|
| |
| |
| |
| | |
hash lookup should be faster than searching an array.
|
| | |
|
| |
| |
| |
| | |
this makes scope rollback much easier
|
| |
| |
| |
| |
| | |
we know the routes should not be "optimized" when mounting an
application
|
| |
| |
| |
| | |
this way we only have to test for whether it is a rails app once.
|
| |
| |
| |
| |
| | |
Use an is_a check to ensure it's a Railsish app so we can avoid
respond_to calls everywhere.
|
| | |
|
| |
| |
| |
| |
| | |
Hopefully `object.class` always returns something that is_a?(Class), so
the previous logic didn't really make sense.
|
| | |
|
| |
| |
| |
| | |
Now we can override how requests are dispatched in the routeset object
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Prior to this commit shallow resources would only generate paths for
non-direct children (with a nested depth greater than 1).
Take the following routes file.
resources :blogs do
resources :posts, shallow: true do
resources :comments do
resources :tags
end
end
end
This would generate shallow paths for `tags` nested under `posts`,
e.g `/posts/:id/tags/`, however it would not generate shallow paths
for `comments` nested under `posts`, e.g `/posts/:id/comments/new`.
This commit changes the behaviour of the route mapper so that it
generate paths for direct children of shallow resources, for example
if you take the previous routes file, this will now generate
shallow paths for `comments` nested under `posts`, .e.g
`posts/:id/comments/new`.
This was the behaviour in Rails `4.0.4` however this was broken in
@jcoglan's fix for another routes related issue[1].
This also fixes an issue[2] reported by @smdern.
[1] https://github.com/rails/rails/commit/d0e5963
[2] https://github.com/rails/rails/issues/15783
|
|/ |
|
| |
|