Commit Graph

108 Commits

Author SHA1 Message Date
Javier Martín
3e871eee80 Don't pluralize resource methods [#4704 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-08-18 13:56:46 -03:00
Andre Arko
fca617af14 Allow member actions (get, etc) to accept strings, with test 2010-08-17 20:41:13 -03:00
Xavier Noria
4434e407e9 adds URL to the body generated by the redirect macro in the routes mapper as per the RFC, extracts common test pattern into a test macro, adds a test to cover the :status option 2010-08-09 13:31:42 +02:00
José Valim
3d7e411953 Routes should respect namespace even if action is a regexp and just controller is given to to. 2010-07-12 15:11:53 +02:00
Andrew White
b802a0d4c7 When a dynamic :controller segment is present in the path add a Regexp constraint that allow matching on multiple path segments.
Using a namespace block isn't compatible with dynamic routes so we
raise an ArgumentError if we detect a :module present in the scope.

[#5052 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-07 00:11:13 +02:00
Andrew White
f4be0041c6 Refactor handling of :only and :except options. The rules are:
1. Don't inherit when specified as an option on a resource
2. Don't push into scope when specified as an option on a resource
2. Resources pull in :only or :except options from scope
3. Either :only or :except in nested scope overwrites parent scope

[#5048 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-06 20:46:20 +02:00
José Valim
8079484b11 Recognize should also work with route is wrapped in a constraint. 2010-07-06 00:39:13 +02:00
Andrew White
aa31a255c8 Fix syntax of routing tests so they actually run
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-04 18:49:26 +02:00
Andrew White
c6843e2337 Refactor resource options and scoping. Resource classes are now only responsible for controlling how they are named. All other options passed to resources are pushed out to the scope.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-04 13:20:48 +02:00
José Valim
9e6e648732 Fix routes with :controller segment when namespaced [#5034 state:resolved] 2010-07-02 19:13:00 +02:00
José Valim
06681af518 A couple enhancements to the router:
* Allow to use the get :symbol shortcut outside resources scopes as well;

* Fix a bug where :action was not being picked from given options;

* Giving :as option inside a resource now changes just the relative name instead of the full name;
2010-06-30 12:34:15 +02:00
Andrew White
e717631a84 Merge :constraints from scope into resource options [#2694 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 14:22:35 +02:00
Andrew White
19ccd4628c Remove invalid conditions from route [#4989 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 12:25:19 +02:00
Andrew White
d4e1a2ef0d Support optional static segements as well [#4832 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 12:02:29 +02:00
Paul Barry
59b24ceb0c Fixed normalize_path in Routing::Mapper to handle optional prefix segments with static and dynamic parts
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 12:02:24 +02:00
Andrew White
9a6fc9a540 Don't force pluralization of controller name when defining a resource [#4980 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 10:16:30 +02:00
Andrew White
5f64bce10f Failing test for whether glob parameters accept regexps
[#4970 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 10:17:28 -07:00
Andrew White
3d8200318a Add failing test case for parameters with periods
[#2536 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 10:12:11 -07:00
Andrew White
df15ba7ead Fix namespaced redirects [#4389 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-24 13:26:24 +02:00
Carlos Antonio da Silva
9651ca751c Add the :path option to match routes when given as symbols. This is specially useful in http helpers for generating routes in scenarios like:
resources :users, :path => 'usuarios' do
    get :search, :on => :collection, :path => 'pesquisar'
  end

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 00:49:15 +02:00
José Valim
61317b643a Provive resources_path_names helpers in the router. 2010-06-23 00:43:25 +02:00
Carlos Antonio da Silva
aacb83143f Allow namespace accept options in routes [#4936 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-22 23:37:49 +02:00
José Valim
fef5cf92ed Deprecate :name_prefix in the new router DSL. 2010-06-22 23:30:19 +02:00
Andrew White
1f84061c5c Don't use module to work out shallow name prefix and path as it may not accurately reflect the actual namespace [#4899 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:15:48 +02:00
Andrew White
65ce3d1297 Accept an object for :constraints option [#4904 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:15:30 +02:00
Andrew White
bf59717b43 Custom resource routes should be scoped
[#3765]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-19 00:15:06 -07:00
Josh Kalderimis
9d3eeb9053 fix for :shallow in router not generating helpers for create, update, and destroy actions when :only or :except are used
[#4900 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-18 13:59:14 -07:00
Andrew White
6db9558416 Add shallow routing option to new router [#3765 status:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2010-06-17 09:52:55 -05:00
José Valim
5c9f27abaa Add more cases to previous commit [#4394 state:resolved] 2010-06-08 23:26:51 +02:00
Jan De Poorter
4560385fa4 Make sure namespaces are nested within resources
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-08 23:21:53 +02:00
David Heinemeier Hansson
03be27092b Revert "Add shallow routes to the new router" for now. Needs more work.
This reverts commit 67a60ee314f53abcde78f8ecd2a1f7c9ef8264e1.
2010-06-08 16:20:46 -04:00
Andrew White
a7edddf605 Fix resources ignoring scope options
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-08 19:33:27 +02:00
Andrew White
4740fbac85 Add support for actions on a new resource to the new routing DSL [#4328 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-08 09:11:39 +02:00
Diego Carrion
67a60ee314 Add shallow routes to the new router [Closes #3765] 2010-06-07 18:09:20 -05:00
José Valim
1a8f784a23 member on resource should not expect an ID. 2010-06-07 11:20:54 +02:00
Rizwan Reza
ac9f8e1b7b Router accepts member routes on resource. [#4624 state:resolved] 2010-06-06 21:27:52 -04:00
José Valim
107c6381a0 Allow root to be given in the resources scope without need to specify :on => collection. 2010-05-17 17:39:32 +02:00
Carl Lerche
6c280f3398 RouteSet does not raise ActionController::RoutingError when no routes match anymore. Instead, it follows the X-Cascade convention. ShowExceptions checks for X-Cascade so that the routing error page can still be displayed. 2010-04-30 16:40:42 -07:00
Cezary Baginski
490a3335d5 Action Pack: fix tests with -K*, work around Ruby 1.9.1 constant lookup.
[#4473 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-25 17:00:20 -07:00
Santiago Pastorino
ed0ca5db9e Add a test for assert_recognizes on ActionDispatch::IntegrationTest [#4390 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-24 15:43:12 -07:00
Diego Carrion
8c7e8976e9 added shorthand support for routes like /projects/status(.:format)
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-17 17:53:08 -07:00
José Valim
86defed5ad Fix a bug in url generation for generic routes. 2010-04-12 20:23:35 +02:00
José Valim
a8b1ca26d7 Ensure match path, :controller => name works as expected. 2010-04-12 16:49:41 +02:00
Santiago Pastorino
5b89fd07b2 Make namespace work with options[:to] [#4351 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-11 12:05:43 +02:00
Jeremy Kemper
7353fc1595 Dial back from 'namespace :controller => ...' to 'scope :module => ...' 2010-04-09 23:09:15 -07:00
Jeremy Kemper
561d9eff0c Add test showing root match in path namespace 2010-04-09 22:12:06 -07:00
Jeremy Kemper
ac0280c39d Routes can be selectively namespaced by path or controller module 2010-04-09 21:48:35 -07:00
wycats
b546945b51 Reapply redirect {|params, request| } with passing tests this time 2010-04-04 13:17:14 -07:00
wycats
ab8bf9e152 * Change the object used in routing constraints to be an instance of
ActionDispatch::Request rather than Rack::Request.

* Changed ActionDispatch::Request#method to return a String, to be
  compatible with the Rack::Request superclass.

* Changed ActionDispatch::Request#method to return the original
  method in the case of methodoverride and #request_method not to,
  to be compatible with Rack::Request
2010-04-03 20:24:30 -07:00
José Valim
a0cdb0499e Maintain the usage of :as consistent in the router. Whenever it's supplied, it changes the NAMED ROUTE. If you want to change the PATH, use :path instead. Example: resources :projects, :path => 'projetos' 2010-04-02 19:13:47 +02:00