Commit Graph

95 Commits

Author SHA1 Message Date
Jose and Yehuda
56cdc81c08 Remove default match without specified method
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
2012-04-24 22:52:26 -05:00
David Lee
002713c645 Add config.default_method_for_update to support PATCH
PATCH is the correct HTML verb to map to the #update action. The
semantics for PATCH allows for partial updates, whereas PUT requires a
complete replacement.

Changes:
* adds config.default_method_for_update you can set to :patch
* optionally use PATCH instead of PUT in resource routes and forms
* adds the #patch verb to routes to detect PATCH requests
* adds #patch? to Request
* changes documentation and comments to indicate support for PATCH

This change maintains complete backwards compatibility by keeping :put
as the default for config.default_method_for_update.
2012-02-22 08:47:10 -08:00
Carlos Antonio da Silva
71566c3573 Remove rescue_action from compatibility module and tests 2012-01-17 10:04:37 -02:00
Aaron Patterson
a08bee7841 all routes can be stored in the Journey Routes object 2011-09-12 16:50:48 -07:00
Aaron Patterson
ac1a363c6e Pull up a method we only use once. 2011-09-08 16:04:57 -07:00
Aaron Patterson
41a085ebc9 Conditions must never be equal 2011-09-08 16:04:57 -07:00
thedarkone
4d4d2179f6 There is no need to be destructive with the passed-in options.
This fixes a bug that is caused by Resource/SingletonResource mangling resource options when using inline "multi"-resource declarations.
2011-07-28 20:00:48 +02:00
Prem Sichanugrist
a9f3c9da01 Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
Carlos Antonio da Silva
11fccc5f06 Cleanup deprecation warnings in Action Controller
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:40:45 +02:00
José Valim
8a3461b8c1 Remove a few tests from old router that do not make sense with the new one. 2010-09-05 15:59:35 +02:00
Łukasz Strzałkowski
8f2c0bf1a0 This test is invalid for new router 2010-09-05 13:44:39 +02:00
Piotr Sarnacki
3088b4f84f raise error on invalid HTTP methods or :head passed with :via in routes 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
8958f332bb Implemented resources :foos, :except => :all option 2010-09-05 13:44:37 +02:00
Piotr Sarnacki
415bacd7bf Fixed almost all resources tests 2010-09-05 13:44:36 +02:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d0b414564e919f67d339fac067a56e6.
2010-09-02 21:11:03 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
Santiago Pastorino
ad4272922d object/try should be required after abstract_unit to have AS in the load path 2010-08-14 18:33:38 -03:00
Xavier Noria
4f7565c4de adds missing requires for Object#try 2010-08-09 15:25:21 +02:00
Joshua Peek
cdf8c35ffd Consistent routing language 2010-03-30 14:05:42 -05:00
Andrew White
96bc6bcfee Don't force singularization of singleton resource names, e.g. /preferences [#4089 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2010-03-15 09:45:29 -05:00
Carlhuda
050831803a If IntegrationSession is initialized with an objects that responds to #routes, automatically extend the URL helpers from the RouteSet onto it 2010-02-26 17:18:45 -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
f863045c45 Rename metaclass to singleton_class 2010-02-25 17:56:58 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
Carl Lerche
6a061187e2 Remove ActionController::Base.resources_path_names 2010-02-24 10:52:16 -08:00
Martin Schürrer
6bc24d40d5 Use ActionDispatch::Routing everywhere 2010-02-21 13:43:51 -08:00
Joshua Peek
be968ecd8b Respect resources_path_names and :path_names options in new dsl 2010-01-13 20:26:01 -06:00
Joshua Peek
0f51e45307 optimise_named_routes is unnecessary 2010-01-13 20:22:53 -06:00
Joshua Peek
588225f885 Remove fancy method not allowed resource exceptions since they are
too much of a hack
2009-12-11 00:01:22 -06:00
Joshua Peek
a1ce52effc New routing dsl 2009-10-20 12:31:23 -05:00
Joshua Peek
df68cae0c0 Group together all the old routing dsl logic 2009-10-20 10:46:27 -05:00
Joshua Peek
a74022ecd3 Move Routing into AD 2009-10-20 10:14:46 -05:00
Joshua Peek
a0e43073e2 Rewrite resource routing tests that are coupled to the router implementation 2009-09-13 18:43:16 -05:00
Hugo Peixoto
202b091373 Added both the documentation and a test case for the collection path name customization feature.
[#1218 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:26:36 -07:00
Ruy Asan
3be3470fab Added routing test for irregular ID requirements and custom member action.
[#2595 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-01 15:02:32 -07:00
Mike Gunderloy
07710fd3e0 Fix requirements for additional member/collection routes [#2054 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-14 10:06:00 -05:00
Joshua Peek
5b025a1d11 Revert 5b7527ca "Failing test for routes with member & requirement" [#2054 state:wontfix] 2009-03-13 17:13:18 -05:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Tom Stuart
5c87e9addd Ensure shallow routes respects namespace [#1356 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 22:50:58 +00:00
Mike Gunderloy
5b7527ca44 Failing test for routes with member & requirement [#2054 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-03-05 18:46:59 -06:00
Mike Gunderloy
ce56c5daa8 Allow routes with a trailing slash to be recognized
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2039 state:committed]
2009-03-04 14:27:39 +13:00
Tarmo Tänav
80747e9db1 Removed map.resources :only/:except inheritance
It's very rare for these options to apply identically to nested child resources, and with this inheritance on it's very difficult to have a child resource with more actions than the parent.

This reverts commit 2ecec6052f7f290252a9fd9cc27ec804c7aad36c.

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1826 state:committed]
2009-02-01 14:47:56 +13:00
Aaron Batalion
fef6c32afe Added optimal formatted routes to rails, deprecating the formatted_* methods, and reducing routes creation by 50% [#1359 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-26 10:52:05 +01:00
Geoff Garside
61becfe2b9 Test default singleton resource route to ensure it uses GET. This is important if using map.root :resource instead of map.root :resources for some reason.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-24 19:19:56 +01:00
Jeremy Kemper
51383c57a2 MiniTest compat: don't check for test/unit's assertion in particular 2008-11-22 19:19:12 -08:00
Jeremy Kemper
eeea1a26ec Merge branch 'master' into testing 2008-11-15 12:21:04 -08:00
Tom Stuart
2ecec6052f Make inheritance of map.resources :only/:except options behave more predictably
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-14 12:26:43 +01:00
Tom Stuart
4c09210244 Fix map.resources to always generate named routes if they're needed
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-13 17:49:09 +01:00
Tom Stuart
44a3009ff0 Add :only/:except options to map.resources
This allows people with huge numbers of resource routes to cut down on the memory consumption caused by the generated code.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1215 state:committed]
2008-11-12 12:57:58 +01:00