Commit Graph

67 Commits

Author SHA1 Message Date
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
José Valim
772a0226fd Add a test which ensures slugs in :id work. 2010-03-31 00:19:40 +02:00
Rizwan Reza
cf6734fdf9 Add more tests and docs to uncountable routes. [#3930 state:resolved] 2010-03-28 18:34:48 -07:00
Jan De Poorter
72074aac33 Add _index to named collection routes for uncountable resources (e.g. Sheep)
Signed-off-by: Rizwan Reza <rizwanreza@gmail.com>
2010-03-28 18:34:48 -07:00
Andrew White
e1a70faea6 Add constraints to resources in new routing DSL
Signed-off-by: Rizwan Reza <rizwanreza@gmail.com>
2010-03-28 23:31:13 +04:30
Andrew White
39c35ff04b Fix named routes for member actions of singleton resources [#4266 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 00:49:47 -07:00
Andrew White
3d746fcdb5 Add parameter defaults support to new routing DSL [#4265 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 00:21:10 -07:00
José Valim
b2c2b0ce45 Rails router automatically calculated for you the controller and named routes in the following scenarios:
match "home/about"                 #=> maps to home#about with named route home_about_path
  match "about"                      #=> does not work because it cannot guess the controller
  match "about" => "home#about"      #=> maps to home#about with named route home_about_path
  match "home/about", :as => "about" #=> maps to home#about with named route about_path
2010-03-26 15:51:51 +01:00
José Valim
4998e097cc Make router shortcuts more polite to URLs starting with a leading slash. 2010-03-22 21:07:37 +01:00
Joshua Peek
13a783672a Install url helpers on module instance so they can be accessed
globally
2010-03-17 16:05:29 -05:00
Joshua Peek
1cc2a61ea6 Allow default_url_options to be set on route set 2010-03-09 21:20:13 -06:00
Jan De Poorter
dfc7ff6429 Make sure nested singular resources get the correct name
[#3911 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-07 14:36:26 -08:00
Carlhuda
98f77e0827 Rename named_url_helpers to url_helpers and url_helpers to url_for 2010-02-26 15:04:50 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
Martin Schürrer
6bc24d40d5 Use ActionDispatch::Routing everywhere 2010-02-21 13:43:51 -08:00
José Valim
19787e6259 Should allow symbols in :only and :except in routes. 2010-02-16 22:39:08 +01:00
José Valim
22c0390085 Add a test which ensures namespaced roots. 2010-02-06 11:52:28 +01:00
José Valim
8974dac92e Ensure root routes inside optional scopes works as expected. 2010-01-26 00:55:26 +01:00
Joshua Peek
e9a1dbe79a Allow custom controller for resource(s) [#3703 state:resolved] 2010-01-16 15:16:22 -06:00
José Valim
5a5760828b Add tests for simple match with namespace. 2010-01-15 23:36:03 +01:00
Joshua Peek
b2578a148c Fix singleton resource named routes 2010-01-15 16:31:00 -06:00
Joshua Peek
576b8dda52 Cleanup internal resource macro to use method helper shorthand 2010-01-15 16:13:01 -06:00
Joshua Peek
184ef28f55 Routing method shorthand shouldn't clobber :to options 2010-01-15 14:55:13 -06:00
Joshua Peek
be968ecd8b Respect resources_path_names and :path_names options in new dsl 2010-01-13 20:26:01 -06:00
José Valim
35933822de Ensure optional path scopes are properly handled. 2010-01-14 01:31:17 +01:00
Joshua Peek
d01716731b Add router support for resources :only and :except actions 2010-01-13 17:23:14 -06:00
Joshua Peek
5d787590f2 Cool this routing test passes now 2010-01-13 16:42:47 -06:00
Joshua Peek
bf9b81e2cb Pass :as to resources to change the resource name 2010-01-13 12:18:06 -06:00
Joshua Peek
521ef3c40f Passing in a crud action overloads the default action instead of creating a
new member action.
2010-01-13 11:45:27 -06:00
José Valim
8d72ba51ba Ensure nested namespaces work as expected. 2010-01-10 18:42:45 +01:00
Joao Carlos
36969c6ecd Fixes namespaced routes [#3673 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-10 12:49:31 +01:00
José Valim
0d5ce7c525 namespace in routes changes both the path and name prefix. 2010-01-06 09:51:46 +01:00
José Valim
e55d70a380 redirect in routes takes port into account [#3653 status:resolved] 2010-01-05 23:40:56 +01:00
Joshua Peek
b3900a29eb All router redirect helper to accept a full URI [#3653 state:resolved] 2010-01-05 12:00:38 -06:00
David Heinemeier Hansson
95762cbbb3 Added shorthand for match 'products/overview' that expands to match 'products/overview', :to => 'products#overview', :as => 'products_overview' 2009-12-27 14:13:03 -08:00
David Heinemeier Hansson
38af368360 Merge 2009-12-24 15:24:57 -08:00
David Heinemeier Hansson
2b7256a42e Extract Mapping class from monster match method 2009-12-24 15:23:39 -08:00
Sam Ruby
aa3565f3a6 Allow named_routes to be used with root, and with new DSL short-form.
The real use case it to make all of the following act the same:

  root 'store#index', :as => 'store'
  match '/' => 'store#index', :as => 'store'
  match '/', :to => 'store#index', :as => 'store'

The test case provided deviates from this in order to demonstrate all three
forms in a single set of test routes.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 20:55:21 -08:00
Jeremy Kemper
4d3602a8c4 Routing: fix that route shorthand shouldn't ignore other options. Raise if :as option is given to root method since its name is always 'root' 2009-12-23 17:42:30 -08:00
David Heinemeier Hansson
8e48a5ef0c Add test for root 2009-12-21 21:49:36 -08:00
David Heinemeier Hansson
3ff9e9ee14 Its now possible to use match 'stuff' => 'what#stuff' instead of using the :to for simple routes 2009-12-20 20:37:36 -08:00
Yehuda Katz
e48b4c2dd0 :to => redirect() can take a String using 1.9-style interpolation or proc that takes the path parameters as a Hash 2009-12-20 14:07:32 -08:00