aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/inspector.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #23103 from rails/refactor-handling-of-action-defaultJeremy Daer2016-04-241-2/+2
|\ | | | | | | Refactor handling of :action default in routing
| * Refactor handling of :action default in routingAndrew White2016-02-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | [ci skip] Replace usage of rake routes with rails routesAbhishek Jain2016-02-251-1/+1
| |
* | Add `internal` attribute to routesJon Moss2016-02-221-1/+1
|/ | | | | | | | | | | | | | 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.
* Fixes routes to match verbs and path with -g optionAbhishek Jain2016-02-111-2/+3
|
* Converge on filter.Kasper Timm Hansen2016-02-011-5/+4
| | | | | | | | 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.
* Simplify filter normalization.Kasper Timm Hansen2016-02-011-5/+3
| | | | | | | 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 options for rake routes taskVipul A M2016-02-021-15/+19
| | | | | | | | | | 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]
* Better error message when running `rake routes` with CONTROLLER arg:Edouard CHIN2016-01-071-7/+18
| | | | | | | - `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
* Change `Journey::Route#verb` to return string instead of regexp.yui-knk2015-10-031-4/+0
| | | | | | | | | 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.
* Don't reference sprockets assets on action packArthur Neves2015-04-261-1/+1
| | | | | | | | 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 railsbrainopia2015-02-231-22/+4
| | | | | | | | 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.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-3/+1
|
* Remove redundant `to_s` in interpolationclaudiob2014-10-301-1/+1
|
* we do not need to cache rack_appAaron Patterson2014-05-261-9/+3
|
* a redirect is not a dispatcher by definition, so eliminate testAaron Patterson2014-05-261-1/+1
|
* push is_a check up to where the Constraints object is allocatedAaron Patterson2014-05-261-1/+1
|
* nothing is passed to `rack_app` anymore, so rm the paramsAaron Patterson2014-05-251-1/+1
|
* one fewer is_a checkAaron Patterson2014-05-251-4/+3
|
* Always construct route objects with Constraint objectsAaron Patterson2014-05-241-3/+3
|
* unwrap the constraints object on initialization, eliminate loopsAaron Patterson2014-05-241-1/+1
| | | | | | | 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.
* Fix `rake routes` error when `Rails::Engine` with empty routes is mounted; ↵Maurizio De Santis2014-01-241-3/+3
| | | | | | fixes rails/rails#13810 Squash
* Show routes defined under assets prefixRyunosuke SATO2013-12-191-1/+1
| | | | Closes #9625
* Add mailer previews feature based on mail_view gemAndrew White2013-12-171-1/+1
|
* Fix for routes taskSıtkı Bağdat2013-11-211-1/+2
| | | | This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
* `RoutesInspector` deals with routes using regexp as `:controller` optionYves Senn2013-05-301-1/+1
|
* Add missing require to routes inspectorCarlos Antonio da Silva2013-02-191-0/+1
|
* Duck typing is hard. Add header to HtmlTableFormatter.Steve Klabnik2013-02-181-0/+4
| | | | | | | Somehow I missed this method, which was then throwing an error when viewing routes as HTML. Make @rubys happy: ✔
* editorial tweaksXavier Noria2013-02-191-3/+6
|
* use strip_heredoc to keep indentation consistent.Steve Klabnik2013-02-181-12/+12
| | | | Thanks @sikachu. :heart:
* Add message when you have no routes defined.Steve Klabnik2013-02-181-0/+25
| | | | | | 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.
* Add headings to rake routes tableSteve Klabnik2013-02-181-3/+19
|
* In Browser Path Matching with Javascriptschneems2013-01-201-1/+22
| | | | | | | | | | | 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
* Fix syntax error :grin:Guillermo Iguaran2013-01-181-1/+1
|
* Remove "Application" section title from routesschneems2013-01-181-6/+13
| | | | | | | | | 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
* Rename route_wrapper partial layout to tableCarlos Antonio da Silva2013-01-061-1/+1
| | | | | | 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.
* Move table routes formatter class to the inspector and rename itCarlos Antonio da Silva2013-01-061-0/+18
| | | | | | | 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.
* Remove warning, remove not used variable, and make methods privateCarlos Antonio da Silva2013-01-051-3/+5
| | | | Warning: "shadowing outer local variable - routes".
* split formatting concerns from RoutesInspectorYves Senn2013-01-051-20/+42
|
* Ruby 1.9 style hash in Route Inspectorschneems2012-12-271-1/+1
|
* Revert "Merge pull request #8499 from schneems/schneems/html-route-inspector"Steve Klabnik2012-12-141-24/+7
| | | | | | | This reverts commit ae68fc3864e99ab43c18fd12577744e1583f6b64, reversing changes made to 0262a18c7b0ab6f60fee842b3007388f9ffeb0fa. See here: https://github.com/rails/rails/pull/8499#issuecomment-11356417
* Output routes in :html formatschneems2012-12-121-7/+24
| | | | | | 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.
* Match the controller and path names defensively.Hiro Asari2012-12-101-1/+1
| | | | Use '\A' instead of '^', and make the alteration shorter.
* Use Rails to Render Default Index Pageschneems2012-12-101-1/+1
| | | | | | | | | | | | | | | 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.
* Revert "Use flat_map { } instead of map {}.flatten"Santiago Pastorino2012-10-051-2/+2
| | | | | | | | | | | 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]]
* Use flat_map { } instead of map {}.flattenSantiago Pastorino2012-10-051-2/+2
|
* fixing most tests on Ruby 2.0Aaron Patterson2012-09-251-1/+1
|
* Rename RouteInspector to RoutesInspectorCarlos Antonio da Silva2012-07-081-1/+1
| | | | Follow the consistency defined in dbc43bc.
* move route_inspector to actionpack@schneems and @mattt2012-07-071-0/+121
this is so we can show route output in the development when we get a routing error. Railties can use features of ActionDispatch, but ActionDispatch should not depend on Railties.