| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|\
| |
| |
| | |
Refactor handling of :action default in routing
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The longstanding convention in Rails is that if the :action parameter
is missing or nil then it defaults to 'index'. Up until Rails 5.0.0.beta1
this was handled slightly differently than other routing defaults by
deleting it from the route options and adding it to the recall parameters.
With the recent focus of removing unnecessary duplications this has
exposed a problem in this strategy - we are now mutating the request's
path parameters and causing problems for later url generation. This will
typically affect url_for rather a named url helper since the latter
explicitly pass :controller, :action, etc.
The fix is to add a default for :action in the route class if the path
contains an :action segment and no default is passed. This change also
revealed an issue with the parameterized part expiry in that it doesn't
follow a right to left order - as soon as a dynamic segment is required
then all other segments become required.
Fixes #23019.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is meant to provide a way for Action Cable, Sprockets, and possibly
other Rack applications to mark themselves as internal, and to exclude
themselves from the routing inspector, and thus `rails routes` / `rake
routes`.
I think this is the only way to have mounted Rack apps be marked as
internal, within AD/Journey. Another option would be to create an array
of regexes for internal apps, and then to iterate over that everytime a
request comes through. Also, I only had the first `add_route` method set
`internal`'s default to false, to avoid littering it all over the
codebase.
|
| |
|
|
|
|
|
|
|
|
| |
Some places were saying filter, while others said filter_options, spare the ambiguity
and use filter throughout.
This inlines a needless local variable and clarifies a route filter consists of defaults
and values to match against.
|
|
|
|
|
|
|
| |
Assume the filter is a string, if it wasn't a hash and isn't nil. Remove needless else
and rely on Ruby's default nil return.
Add spaces within hash braces.
|
|
|
|
|
|
|
|
|
|
| |
Add two options: `-c` and `-g`.
`-g` option returns the urls name, verb and path fields that match the pattern.
`-c` option returns the urls for specific controller.
Fixes #18902, and Fixes #20420
[Anton Davydov & Vipul A M]
|
|
|
|
|
|
|
| |
- `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome)
- If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist
- If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter
- If no routes were defined in the config/routes.rb file, will warn the user with the original message
|
|
|
|
|
|
|
|
|
| |
By [this commit](https://github.com/rails/rails/commit/0b476de445faf330c58255e2ec3eea0f3a7c1bfc)
`Journey::Route#verb` need not to return verb as regexp.
The returned value is used by inspector, so change it to be a string.
Add inspect_with_multiple_verbs test case to keep the behavior of
inspector correctly.
|
|
|
|
|
|
|
|
| |
We need to ignore the `assets_prefix` when running a command like `rake
routes`. However we cannot reference asserts_prefix from action_pack as
that is a sprockets-rails concern.
See this is now implemented on sprockets-rails
https://github.com/rails/sprockets-rails/commit/85b89c44ad40af3056899808475e6e4bf65c1f5a
|
|
|
|
|
|
|
|
| |
Change filter on /rails/info/routes to use an actual path regexp from rails
and not approximate javascript version. Oniguruma supports much more
extensive list of features than javascript regexp engine.
Fixes #18402.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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
*think* they were just being defensive, but I have no idea.
|
|
|
|
|
|
| |
fixes rails/rails#13810
Squash
|
|
|
|
| |
Closes #9625
|
| |
|
|
|
|
| |
This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Somehow I missed this method, which was then throwing an error
when viewing routes as HTML.
Make @rubys happy: ✔
|
| |
|
|
|
|
| |
Thanks @sikachu. :heart:
|
|
|
|
|
|
| |
Print a message in both `rake routes` and at GET "/rails/info/routes"
that lets you know you have no routes defined, as well as linking to the
Rails Guide on the topic.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When debugging routes ,it can sometimes be difficult to understand exactly how the paths are matched. This PR adds a JS based path matching widget to the `/rails/info/routes` output. You can enter in a path, and it will tell you which of the routes that path matches, while preserving order (top match wins).
The matching widget in action:
![](http://f.cl.ly/items/3A2F0v2m3m1Z1p3P3O3k/path-match.gif)
Prior to this PR the only way to check matching paths is via mental math, or typing in a path in the url bar and seeing where it goes. This feature will be an invaluable debugging tool by dramatically decreasing the time needed to check a path match.
ATP actionpack
|
| |
|
|
|
|
|
|
|
|
|
| |
This PR standardizes the output of the HTML and console based routes to not include the title for "Application Routes" those that are defined by the application. Instead only routes defined in engines get any special treatment.
Based on this conversation:
https://github.com/rails/rails/commit/af5c0fd85fce1adb311083dd1ecf96432ee8caa3#commitcomment-2458823
ATP actionpack /cc @carlosantoniodasilva
|
|
|
|
|
|
| |
It is used by the table formatter only, and it's already inside a routes
directory that namespaces it properly, so calling it just "table" seems
simpler.
|
|
|
|
|
|
|
| |
It feels more consistent to have this class called "HtmlTableFormatter",
and to have it here with the routes inspector and console formatter,
since it's used for both routing error exceptions and the rails info
page.
|
|
|
|
| |
Warning: "shadowing outer local variable - routes".
|
| |
|
| |
|
|
|
|
|
|
|
| |
This reverts commit ae68fc3864e99ab43c18fd12577744e1583f6b64, reversing
changes made to 0262a18c7b0ab6f60fee842b3007388f9ffeb0fa.
See here: https://github.com/rails/rails/pull/8499#issuecomment-11356417
|
|
|
|
|
|
| |
By formatting routes for different media (txt/html) we can apply optimizations based on the format. We can include meta-data in the HTML to allow a rich experience while rendering and viewing the routes. This PR shows route helpers as they are used with the `_path` extension, it also has a javascript toggle on the top to switch to `_url`. This way the developer can see the exact named route helper they can use instead of having to modify a base.
This is one example of an optimization that could be applied. Eventually we can link out to guides for the different columns to better explain what helper, HTTP Verb, Path, and Controller#action indicate. We could even add a route search box that could allow developers to input a given route and see all of the routes that match it. These are stand alone features and should be delivered separately.
|
|
|
|
| |
Use '\A' instead of '^', and make the alteration shorter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an alternative implementation to #7771 thanks to the advice of @spastorino
Rails is a dynamic framework that serves a static index.html by default. One of my first questions ever on IRC was solved by simply deleting my public/index.html file. This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion.
This PR moves the static index page to an internal controller/route/view similar to `rails/info`. When someone starts a rails server, if no root is defined, this route will take over and the "dynamic" index page from rails/welcome_controller will be rendered. These routes are only added in development. If a developer defines a root in their routes, it automatically takes precedence over this route and will be rendered, with no deleting of files required.
In addition to removing this source of confusion for new devs, we can now use Rails view helpers to build and render this page. While not the primary intent, the added value of "dogfooding" should not be under-estimated.
The prior PR #7771 had push-back since it introduced developer facing files. This PR solves all of the same problems, but does not have any new developer facing files (it actually removes one).
cc/ @wsouto, @dickeyxxx, @tyre, @ryanb, @josevalim, @maxim, @subdigital, @steveklabnik
ATP Railties and Actionpack.
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit abf8de85519141496a6773310964ec03f6106f3f.
We should take a deeper look to those cases flat_map doesn't do deep
flattening.
irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten
=> [1, 3, 1, 2]
irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i}
=> [[1, 3], [1, 2]]
|
| |
|
| |
|
|
|
|
| |
Follow the consistency defined in dbc43bc.
|