aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* use the helpers list rather than getting the methods from the moduleAaron Patterson2013-01-241-1/+1
|
* module_eval is not necessary hereAaron Patterson2013-01-241-3/+1
|
* don't need to eval everythingAaron Patterson2013-01-241-1/+1
|
* Duplicate possible frozen string from routeAndrew White2013-01-211-2/+3
| | | | | | | | | | | | | 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
* 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
* Change the behavior of route defaultsAndrew White2013-01-152-2/+9
| | | | | | | | | | | | | | | | | | | 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
* Add support for other types of routing constraintsAndrew White2013-01-151-103/+149
| | | | | | | | | | | | | | 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.
* Raise correct exception now Journey is integrated.Andrew White2013-01-151-4/+2
| | | | | | | Now that Journey has been integrated into ActionDispatch we can raise the exception ActionController::UrlGenerationError directly rather than raising the internal Journey::Router::RoutingError and then have ActionDispatch::Routing::RouteSet#generate re-raise the exception.
* clearer conditional in constraint match checkGosha Arinich2013-01-101-3/+3
|
* 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
|
* refactor Routing::MapperGosha Arinich2013-01-031-9/+4
|
* Fix usage of lambda as a Rack endpointJiri Pospisil2012-12-311-2/+2
| | | | The response body needs to respond_to? :each.
* Merge pull request #8627 from schneems/schneems/routes-1-9Rafael Mendonça França2012-12-261-1/+1
|\ | | | | Ruby 1.9 style hash in Route Inspector
| * Ruby 1.9 style hash in Route Inspectorschneems2012-12-271-1/+1
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-12-211-0/+5
|\ \
| * | Add script_name option description and example for #url_for optionsIvan Vanyak2012-12-171-0/+5
| |/
* / Integrate Journey into Action DispatchAndrew White2012-12-191-1/+1
|/ | | | | | | | Move the Journey code underneath the ActionDispatch namespace so that we don't pollute the global namespace with names that may be used for models. Fixes rails/journey#49.
* 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
* Merge pull request #8510 from thedarkone/thread_safety_improvementsAaron Patterson2012-12-141-8/+4
|\ | | | | Thread safety improvements
| * Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* | Clear url helper methods when routes are reloadedAndrew White2012-12-141-0/+6
| | | | | | | | | | Remove all the old url helper methods when clear! is called on the route set because it's possible that some routes have been removed.
* | Revert "Clear url helpers when reloading routes"Andrew White2012-12-141-1/+0
| | | | | | | | | | | | | | | | | | | | This doesn't actually remove old url helper methods as they are defined in a different module. This reverts commit 96bcef947bf713b7d9fc88f26dff69f568111262. Conflicts: actionpack/CHANGELOG.md
* | 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.
* Merge pull request #8412 from ↵Rafael Mendonça França2012-12-051-18/+14
|\ | | | | | | | | JoeyButler/action_dispatch_routing_mapper_refactoring Extract method refactoring.
| * Extract method refactoring in ActionDispatch::Routing::SingletonResource.Joey Butler2012-12-051-18/+14
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-12-042-6/+0
|\ \ | | | | | | | | | | | | Conflicts: guides/source/migrations.md
| * | Cleans and removes useless 'Examples' tag [ci skip]Alvaro Pereyra2012-12-012-6/+0
| |/
* / Fixed issue where routes with globs caused constraints on that glob toMaura Fitzgerald2012-12-041-1/+1
|/ | | | | | be ignored. A regular expression constraint gets overwritten when the routes.rb file is processed. Changed the overwriting to an ||= instead of an = assignment.
* Refector a bit to remove extra slice iteration and splat callCarlos Antonio da Silva2012-11-241-2/+2
| | | | | | | | | 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.
* Use merge! in some places to avoid creating extra hashesCarlos Antonio da Silva2012-11-242-4/+4
|
* Simplify scope options recovery by using merge!Carlos Antonio da Silva2012-11-241-6/+1
| | | | | | 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.
* Normalize scope recovering :blocks option nameCarlos Antonio da Silva2012-11-241-3/+3
| | | | | Use the same :blocks key in the recover hash to revert the scope options later.
* Simplify constraints condition in scope when checking for HashCarlos Antonio da Silva2012-11-241-7/+4
|
* Allow setting a symbol as path in scope on routesGuillermo Iguaran2012-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Was surprising found that this example doesn't work: scope :api do resources :users end and the right form to use it is: scope 'api' do resources :users end I think this should work similary as `namespace` where both are allowed. These two are equivalent: namespace :api do resources :users end namespace 'api' do resources :user end
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-171-17/+22
|\ | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb
| * update syntax and add note about prompt use of HttpHelpers [ci-skip]Cesar Carruitero2012-11-091-12/+17
| |
| * correct link syntax [ci-skip]Cesar Carruitero2012-11-091-5/+5
| |
| * change rdoc syntax for adecuate render [ci-skip]Cesar Carruitero2012-11-091-1/+1
| |
| * change match to get and add single quotes in routing/redirection [ci-skip]Cesar Carruitero2012-11-081-8/+8
| |
* | Use get in the redirection doc examplesCarlos Antonio da Silva2012-11-091-7/+7
| | | | | | | | | | | | | | get is the most common usage, and match without an explicit verb was disallowed in 56cdc81c08b1847c5c1f699810a8c3b9ac3715a6. [ci skip]
* | routing prefix slash replacement is no longer necessaryYves Senn2012-11-041-3/+1
| |
* | Clear url helpers when reloading routesSantiago Pastorino2012-11-021-0/+1
|/
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-035-83/+83
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md