| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a route is mounted inside a resources block, it's automatically
prefixed, so a following code:
resources :users do
mount Blog::Engine => '/blog'
end
will generate a user_blog path helper.
In order to access engine helpers, we also use "mounted_helpers", a list
of helpers associated with each mounted engine, so a path to blog's post
can be generated using user_blog.post_path(user, post).
The problem I'm fixing here is that mount used a raw :as option, without
taking nestings into account. As a result, blog was added to a route set
as a `user_blog`, but helper was generated for just `blog`.
This commit applies the proper logic for defining a helper for a mounted
engine nested in resources or resource block.
(closes #8533)
|
|\
| |
| |
| |
| |
| | |
Conflicts:
activesupport/lib/active_support/core_ext/hash/deep_merge.rb
activesupport/lib/active_support/core_ext/hash/keys.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
According to our guideline, we leave 1 space between `#` and `=>`, so we
want `# =>` instead of `#=>`.
Thanks to @fxn for the suggestion.
[ci skip]
|
| |
| |
| |
| | |
Only set the value once after it's calculated.
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
These errors occur when, there routes are wrongly defined.
example, the following line would cause a missing :action error
root "welcomeindex"
Mostly beginners are expected to hit these errors, so lets improve the error message a bit to make their learning experience bit better.
|
|
|
|
|
|
|
|
| |
This reverts commit ab5cd54b7e791f8419f689d1bef5394890268a6f, reversing
changes made to cdc10c898d4865302740340eedec4f5f4ca76565.
Reason: This way of defining root path is still supported. See
https://github.com/rails/rails/blob/d262773ab7f0aae5de2d354ac2eca168e95b653d/actionpack/test/controller/routing_test.rb#L450-457
|
|\ |
|
| |
| |
| |
| |
| |
| | |
The documentation in this section is referring to a profile,
so the resource that's created should probably also be a
profile of some sort.
|
| |
| |
| |
| |
| |
| | |
The docs refference a blacklist, but really what's being described
is a whitelist. Anything that matches the constraint gets through to
the path.
|
| | |
|
|/
|
|
|
|
|
|
| |
This piece of documentation is out of date.
The use of match without any via option is prevented, now
the HTTP verbs have to be explicitly set. If they're not set then
the error message in normalize_conditions! (around line 186) is
shown.
|
|
|
|
|
|
|
|
|
| |
Merge `:action` from routing scope and assign endpoint if both `:controller`
and `:action` are present. The endpoint assignment only occurs if there is
no `:to` present in the options hash so should only affect routes using the
shorthand syntax (i.e. endpoint is inferred from the the path).
Fixes #9856
|
| |
|
| |
|
| |
|
|
|
|
| |
It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
|
|
|
|
| |
mapper) and adding a constant for all the possible scopes.
|
|\
| |
| | |
routing bugfixes when matching multiple paths
|
| |
| |
| |
| |
| |
| | |
Closes #9913.
We need to expand the match shorthand syntax for every path.
|
| |
| |
| |
| |
| |
| | |
This problem was introduced with:
https://github.com/rails/rails/commit/d03aa104e069be4e301efa8cefb90a2a785a7bff
|
|/
|
|
|
|
|
| |
Closes #10071
`#normalize_path!` depends on the options so we need to call
`#normalize_options!` first to make sure everything is set correctly.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Closes #9466.
Passing `format: true` used to override the constraints: { format: /json/ }
with `/.+/`. This patch only sets the format if there is no constraint present.
|
|
|
|
| |
Closes #9432.
|
| |
|
|
|
|
|
|
|
|
| |
Closes #7554.
This patch determines the `controller#action` directly
in the `match` method when the shorthand syntax is used.
this prevents problems with namespaces and scopes.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The current implementation only works correctly if you supply the `:controller`
with directory notation (eg. `:controller => 'admin/posts'`).
The ruby constant notation (eg. `:controller => 'Admin::Posts`) leads to unexpected problems with `url_for`.
This patch prints a warning for every non supported `:controller` option. I also added documentation how
to work with namespaced controllers. The warning links to that documentation in the rails guide.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ruby 1.9 freezes Hash string keys by default so where a route is
defined like this:
get 'search' => 'search'
then the Mapper will derive the action from the key. This blows up
later when the action is added to the parameters hash and the
encoding is forced.
Closes #3429
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes route defaults so that explicit defaults are no
longer required where the key is not part of the path. For example:
resources :posts, bucket_type: 'posts'
will be required whenever constructing the url from a hash such as a
functional test or using url_for directly. However using the explicit
form alters the behavior so it's not required:
resources :projects, defaults: { bucket_type: 'projects' }
This changes existing behavior slightly in that any routes which
only differ in their defaults will match the first route rather
than the closest match.
Closes #8814
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This now allows the use of arrays like this:
get '/foo/:action', to: 'foo', constraints: { subdomain: %w[www admin] }
or constraints where the request method returns an Fixnum like this:
get '/foo', to: 'foo#index', constraints: { port: 8080 }
Note that this only applies to constraints on the request - path
constraints still need to be specified as Regexps as the various
constraints are compiled into a single Regexp.
|
| |
|
| |
|
|
|
|
| |
The response body needs to respond_to? :each.
|
|\
| |
| |
| |
| | |
JoeyButler/action_dispatch_routing_mapper_refactoring
Extract method refactoring.
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
guides/source/migrations.md
|
| |/ |
|
|/
|
|
|
|
| |
be ignored. A regular expression constraint gets overwritten when the
routes.rb file is processed. Changed the overwriting to an ||= instead
of an = assignment.
|
|
|
|
|
|
|
|
|
| |
This yields a small bit of performance improvement when building the
defaults from constraints, specially considering that it's rather common
for constraints to be empty.
Also, there's a bit of duplicated code in here that I have to check
before extracting.
|
| |
|
|
|
|
|
|
| |
Instead of iterating again over the options and setting one by one, we
can just merge the recover hash back to the scope one since all keys
match.
|
|
|
|
|
| |
Use the same :blocks key in the recover hash to revert the scope options
later.
|
| |
|