aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * 1.9 hash syntax changes to docsAvnerCohen2012-10-315-83/+83
| |
* | Revert "Merge pull request #7668 from Draiken/fix_issue_6497"Rafael Mendonça França2012-11-021-1/+1
|/ | | | | | | | | | | | | | This reverts commit f4ad0ebe7a6b17658bddfeb996e3c34835b75623, reversing changes made to 8b2cbb3a832101f0e672ee309beca0f8c555b292. Conflicts: actionpack/CHANGELOG.md REASON: This added introduced a bug when you have a shorthand route inside a nested namespace. See https://github.com/rafaelfranca/rails/commit/281367eb770faf8077c1fd6194188e92ed1637a1
* 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
|
* resource and resources do no longer modify passed optionsYves Senn2012-10-011-2/+2
| | | | this is a patch for #7777.
* fixing most tests on Ruby 2.0Aaron Patterson2012-09-251-1/+1
|
* Removing to_shorthand from default_controller_and_action. Fixes #6497Luiz Felipe2012-09-191-1/+1
| | | | | When using shortcut routes inside an engine the "to_shorthand" variable is set to true, causing the module scope of the route to not be applied.
* Use internal instance variable naming scheme for mounted URL helper proxiesSam Pohlenz2012-09-091-1/+1
|
* Make enhanced routing Concerns more tell-don't-askErnie Miller2012-09-031-25/+55
|
* Fix concerns not executing block in mapperErnie Miller2012-09-031-2/+19
| | | | Also, add documentation for alternate usage.
* Allow routing concerns to accept a callableErnie Miller2012-09-031-3/+7
| | | | | | This allows us to make alterations to the generated routes based on the scope of the current mapper, and otherwise allows us to move larger blocks of concerns out of the routes file, altogether.
* Update actionpack/lib/action_dispatch/routing/mapper.rbErik Ordway2012-08-291-1/+1
| | | escape the '.'s  
* refactor route_set `generate_extras` functionalityschneems2012-08-281-17/+9
| | | | | | The result of Generator with or without the @extras instance variable set contains the desired information. Rather than preserving state when initializing the original object, we can simply extract the keys from the resultant parameters. ATP Actionpack, railties
* Add Missing Keys from Journey on failed URL formatschneems2012-08-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Many named routes have keys that are required to successfully resolve. If a key is left off like this: <%= link_to 'user', user_path %> This will produce an error like this: No route matches {:action=>"show", :controller=>"users"} Since we know that the :id is missing, we can add extra debugging information to the error message. No route matches {:action=>"show", :controller=>"users"} missing required keys: [:id] This will help new and seasoned developers look closer at their parameters. I've also subclassed the routing error to be clear that this error is a result of attempting to generate a url and not because the user is trying to visit a bad url. While this may sound trivial this error message is misleading and confuses most developers. The important part isn't what's in the options its's what's missing. Adding this information to the error message will make debugging much more obvious. This is the sister pull request of https://github.com/rails/journey/pull/44 which will be required to get they missing keys into the correct error message. Example Development Error in Rails: http://cl.ly/image/3S0T0n1T3421
* removed : warning: `*' interpreted as argument prefixArun Agrawal2012-08-281-1/+1
|
* Don't require action_dispatch in ActionView::UrlHelpersPiotr Sarnacki2012-08-281-0/+2
| | | | | | | | | | ActionDispatch::Routing::UrlFor was always required in UrlHelpers. This was changed by splitting previous implementation of UrlHelper into 2 modules: ActionView::Helpers::UrlHelper and ActionView::Routing::UrlHelper. The former one keeps only basic implementation of url_for. The latter adds features that allow to use routes and is only required when url_helpers or mounted_helpers are required.