aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-1/+1
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* Don't assume resource param is :id when using shallow routesAndrew White2012-07-201-0/+12
| | | | | Since #5581 added support for resources with custom params we should not assume that it is :id when using shallow resource routing.
* Support constraints on resource custom params when nestingAndrew White2012-07-201-1/+12
| | | | | | | The Mapper looks for a :id constraint in the scope to see whether it should apply a constraint for nested resources. Since #5581 added support for resource params other than :id, we need to check for a constraint on the parent resource's param name and not assume it's :id.
* Add support for optional root segments containing slashesAndrew White2012-07-171-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optional segments with a root scope need to have the leading slash outside of the parentheses, otherwise the generated url will be empty. However if the route has non-optional elements then the leading slash needs to remain inside the parentheses otherwise the generated url will have two leading slashes, e.g: Blog::Application.routes.draw do get '/(:category)', :to => 'posts#index', :as => :root get '/(:category)/author/:name', :to => 'posts#author', :as => :author end $ rake routes root GET /(:category)(.:format) posts#index author GET (/:category)/author/:name(.:format) posts#author This change adds support for optional segments that contain a slash, allowing support for urls like /page/2 for the root path, e.g: Blog::Application.routes.draw do get '/(page/:page)', :to => 'posts#index', :as => :root end $ rake routes root GET /(page/:page)(.:format) posts#index Fixes #7073
* Remove more tests related to draw external routes filesRafael Mendonça França2012-06-291-49/+0
| | | | Related with 5e7d6bba79393de0279917f93b82f3b7b176f4b5
* Support unicode character route in config/routes.rb.kennyj2012-06-161-2/+2
|
* Remove implicit dependency on pathnameJosé Valim2012-05-251-1/+1
|
* Return 400 Bad Request for URL paths with invalid encoding.Andrew White2012-05-201-0/+31
| | | | | | | | | Passing path parameters with invalid encoding is likely to trigger errors further on like `ArgumentError (invalid byte sequence in UTF-8)`. This will result in a 500 error whereas the better error to return is a 400 error which allows exception notification libraries to filter it out if they wish. Closes #4450
* add tests and external file backtrace for Routing::Mapper#drawKornelius Kalnbach2012-05-151-0/+49
|
* Copy literal route constraints to defaults - fixes #3571 and #6224.Andrew White2012-05-111-0/+42
|
* Don't ignore nil positional arguments for url helpers - fixes #6196.Andrew White2012-05-101-0/+35
|
* Refactor Generator class to not rely on in-place editing the controllerAndrew White2012-05-091-6/+6
|
* Fix bug when url_for changes controller.Nikita Beloglazov2012-05-091-0/+9
|
* Fix that optimized named routes should also work as singleton methods on the ↵Jeremy Kemper2012-05-061-0/+24
| | | | url_helpers module
* Force given path to http methods in mapper to skip canonical action checkingCarlos Antonio da Silva2012-05-041-1/+8
| | | | | | | | | | | | | | | This fixes the following scenario: resources :contacts do post 'new', action: 'new', on: :collection, as: :new end Where the /new path is not generated because it's considered a canonical action, part of the normal resource actions: new_contacts POST /contacts(.:format) contacts#new Fixes #2999
* Reset the request parameters after a constraints checkAndrew White2012-05-021-0/+19
| | | | | | | | | | | | | A callable object passed as a constraint for a route may access the request parameters as part of its check. This causes the combined parameters hash to be cached in the environment hash. If the constraint fails then any subsequent access of the request parameters will be against that stale hash. To fix this we delete the cache after every call to `matches?`. This may have a negative performance impact if the contraint wraps a large number of routes as the parameters hash is built by merging GET, POST and path parameters. Fixes #2510.
* Restore interpolation of path option in redirect routesAndrew White2012-04-291-1/+32
|
* Escape interpolated params when redirecting - fixes #5688Andrew White2012-04-291-0/+29
|
* Remove default match without specified methodJose and Yehuda2012-04-241-53/+53
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Allow a defining custom member field on resourcesJamie Macey2012-03-251-0/+18
| | | | | | | | | | By default, resources routes are created with :resource/:id. A model defining to_param can make prettier urls by using something more readable than an integer ID, but since the route picks it up as :id you wind up with awkward User.find_by_username(params[:id]) calls. By overriding the key to be used in @request.params you can be more obvious in your intent.
* Remove wrong and redundant code.kennyj2012-02-251-6/+4
|
* uses PATCH for the forms of persisted records, and routes PATCH and PUT to ↵Xavier Noria2012-02-241-0/+8
| | | | the update action of resources
* Testcase for GH #5114.kennyj2012-02-221-0/+26
|
* fixing AP testsAaron Patterson2012-02-151-1/+1
|
* say goodbye to #with_test_routes :axe:Xavier Noria2012-02-101-1166/+947
|
* fixes a regression introduced by 532cd4, and a bogus test in AP the ↵Xavier Noria2012-02-101-6/+6
| | | | regression uncovered
* Fix GH #4720. Routing problem with nested namespace and already camelized ↵kennyj2012-02-101-0/+26
| | | | controller option.
* Fix url_for method's behavior when it is called with :controller option ↵kennyj2012-02-071-0/+33
| | | | | | which starts with "/" from multiple nested controller. Closes #3864
* Revert "Deprecated multi args to http route methods"Jeremy Kemper2012-02-051-2/+1
| | | | | | | | | | Too painful to lose the compact shorthand form! This reverts commit e848c52535fa0f9488cdbdb3f1cedc7c7c02d643. Conflicts: actionpack/lib/action_dispatch/routing/mapper.rb
* Remove not used env[] call in routing_test. Carlos Antonio da Silva2012-01-271-1/+0
| | | The commit 4c321c6d42b6e35f9ead12eb1dccdead03c5abf4 removes the path_params variable assignment, actually the entire line is not used at all.
* Fix warning. assigned but unused variable - path_paramskennyj2012-01-281-1/+1
|
* Merge pull request #4658 from pwim/unicode-pathsAaron Patterson2012-01-251-0/+20
| | | | Test for unicode path support
* Deprecated multi args to http route methodsAaron Patterson2012-01-231-1/+2
|
* Stub ip method of alternative request classSam Pohlenz2012-01-141-0/+4
|
* Fix routing test to use assert_equalCarlos Antonio da Silva2012-01-061-2/+2
|
* just use def setupAaron Patterson2011-12-211-1/+2
|
* Do not raise an exception if an invalid route was generated automatically.José Valim2011-12-161-0/+1
|
* Fix failing AP tests.José Valim2011-12-131-1/+1
|
* Refactoring the redirect method for the router api.Aaron Patterson2011-11-181-0/+5
|
* remove the :path feature to redirects, since it cannot workAaron Patterson2011-11-181-33/+0
|
* require that all blocks have arity of 2Aaron Patterson2011-11-181-1/+1
|
* Symbol captures may generate multiple path segments, so don't escape / -> ↵Jeremy Kemper2011-10-131-7/+17
| | | | %2F. Test splat escaping.
* Failing tests for path parameter escapingJeremy Kemper2011-10-131-0/+27
|
* allow shorthand routes with nested optional parametersDiego Carrion2011-10-101-0/+11
|
* Fix named routes modifying argumentsPawel Pierzchala2011-09-221-0/+11
|
* when calling url_for with a hash, additional (likely unwanted) values (such ↵Andrew Kaspick2011-08-111-0/+12
| | | | as :host) would be returned in the hash... calling #dup on the hash prevents this
* Ensure the constraints block is only applied to the correct routeDave Rogers2011-07-251-0/+20
| | | | | addresses issue #1907 - any routes that follow a route with a constraints block are inheriting the previous route's constraints.
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!