- 27 2月, 2013 2 次提交
- 22 2月, 2013 1 次提交
-
-
由 Yves Senn 提交于
Closes #7554. This patch determines the `controller#action` directly in the `match` method when the shorthand syntax is used. this prevents problems with namespaces and scopes.
-
- 10 2月, 2013 1 次提交
-
-
由 Yves Senn 提交于
-
- 07 2月, 2013 1 次提交
-
-
由 Yves Senn 提交于
The current implementation only works correctly if you supply the `:controller` with directory notation (eg. `:controller => 'admin/posts'`). The ruby constant notation (eg. `:controller => 'Admin::Posts`) leads to unexpected problems with `url_for`. This patch prints a warning for every non supported `:controller` option. I also added documentation how to work with namespaced controllers. The warning links to that documentation in the rails guide.
-
- 22 1月, 2013 1 次提交
-
-
由 Andrew White 提交于
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
-
- 16 1月, 2013 2 次提交
-
-
由 Andrew White 提交于
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
-
由 Andrew White 提交于
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.
-
- 04 12月, 2012 1 次提交
-
-
由 Maura Fitzgerald 提交于
be ignored. A regular expression constraint gets overwritten when the routes.rb file is processed. Changed the overwriting to an ||= instead of an = assignment.
-
- 26 11月, 2012 1 次提交
-
-
由 Andrew White 提交于
Move the routes for each test inside the test method so that it's easier to see which routes are applicable to which test. To ensure that each test wasn't invalidated the changes were done by first removing all of the routes, ensuring that all of the tests failed and then adding the routes back to each test one by one. One test for `assert_recognizes` was removed as it wasn't actually testing the defined routes and is now tested more thoroughly in routing_assertions_test.rb. One downside is that the test suite takes about 1s longer due to having to using `method_missing` for handling the url helpers as using `include url_helpers` isn't isolated for each test.
-
- 22 11月, 2012 1 次提交
-
-
由 Guillermo Iguaran 提交于
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
-
- 03 11月, 2012 2 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
This reverts commit f4ad0ebe, reversing changes made to 8b2cbb3a. 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
-
- 01 10月, 2012 1 次提交
-
-
由 Yves Senn 提交于
this is a patch for #7777.
-
- 19 9月, 2012 1 次提交
-
-
由 Luiz Felipe 提交于
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.
-
- 28 8月, 2012 1 次提交
-
-
由 schneems 提交于
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
-
- 06 8月, 2012 1 次提交
-
-
由 Xavier Noria 提交于
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.
-
- 03 8月, 2012 1 次提交
-
-
由 Xavier Noria 提交于
-
- 20 7月, 2012 2 次提交
-
-
由 Andrew White 提交于
Since #5581 added support for resources with custom params we should not assume that it is :id when using shallow resource routing.
-
由 Andrew White 提交于
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.
-
- 18 7月, 2012 1 次提交
-
-
由 Andrew White 提交于
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
-
- 30 6月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
Related with 5e7d6bba
-
- 15 6月, 2012 1 次提交
-
-
由 kennyj 提交于
-
- 25 5月, 2012 1 次提交
-
-
由 José Valim 提交于
-
- 21 5月, 2012 1 次提交
-
-
由 Andrew White 提交于
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
-
- 15 5月, 2012 1 次提交
-
-
由 Kornelius Kalnbach 提交于
-
- 11 5月, 2012 2 次提交
-
-
由 Andrew White 提交于
-
由 Andrew White 提交于
-
- 09 5月, 2012 2 次提交
-
-
由 Andrew White 提交于
-
由 Nikita Beloglazov 提交于
-
- 07 5月, 2012 1 次提交
-
-
由 Jeremy Kemper 提交于
-
- 05 5月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
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
-
- 03 5月, 2012 1 次提交
-
-
由 Andrew White 提交于
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.
-
- 30 4月, 2012 2 次提交
-
-
由 Andrew White 提交于
-
由 Andrew White 提交于
-
- 25 4月, 2012 1 次提交
-
-
由 Jose and Yehuda 提交于
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
-
- 26 3月, 2012 1 次提交
-
-
由 Jamie Macey 提交于
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.
-
- 25 2月, 2012 2 次提交
-
-
由 kennyj 提交于
-
由 Xavier Noria 提交于
uses PATCH for the forms of persisted records, and routes PATCH and PUT to the update action of resources
-
- 22 2月, 2012 1 次提交
-
-
由 kennyj 提交于
-