Commit Graph

434 Commits

Author SHA1 Message Date
Andrew White
e98893b189 Don't ignore nil positional arguments for url helpers - fixes #6196. 2012-05-10 22:07:14 +01:00
Andrew White
0cfa6b71f2 Reset the request parameters after a constraints check
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.
(cherry picked from commit 56030506563352944fed12a6bb4793bb2462094b)
2012-05-03 00:02:08 +01:00
Andrew White
78c181b701 Escape interpolated params when redirecting - fixes #5688 2012-04-29 21:37:03 +01:00
Arun Agrawal
54d3645e93 :subdomain can now be specified with a value of false in url_for,
allowing for subdomain(s) removal from the host during link generation. 

Closes #4083

cherry-picked from 

de942e5534
96aa3bd0ea
2012-04-01 00:16:38 +05:30
José Valim
bef0b354e4 Avoid inspecting the whole route set, closes #1525 2012-03-27 19:57:47 +02:00
Andrew White
5c18b995c1 Detect optional glob params when adding non-greedy regexp - closes #4817. 2012-02-26 00:29:43 +00:00
Justin Woodbridge
e6fca559a1 Fix typo in match :to docs 2012-02-25 21:55:11 +05:30
José Valim
6d5a27aa6f Override respond_to? since we are also overriding method_missing. 2012-01-03 20:33:14 +01:00
José Valim
39528548b0 Improve cache on route_key lookup.
Conflicts:

	activemodel/lib/active_model/naming.rb
2011-12-08 20:38:09 +01:00
Uģis Ozols
7f6b1a58ac what's -> that's 2011-11-26 20:19:20 +05:30
Alexey Vakhov
740655c497 Fix typo in constraints method documentation 2011-11-05 20:51:32 +05:30
mjy
58b0d507d3 Adds missing closing regex slashes. 2011-10-30 14:52:24 +05:30
Pawel Pierzchala
d87921318c Fix named routes modifying arguments
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-09-22 17:14:10 +02:00
Santiago Pastorino
699b83a2e0 Merge pull request #2577 from rails-noob/master
Fix double slash at start of paths when mounting an engine at the root.
2011-09-06 13:11:14 -03:00
Vijay Dev
d3d2ceaf0f doc fixes 2011-09-01 03:47:13 +05:30
Arun Agrawal
d761ec4864 We actually don't need a reverse_merge! here. dup removed was giving error with nil class. 2011-08-13 08:26:30 +05:30
Santiago Pastorino
d9d78d4165 Merge pull request #2497 from akaspick/url_for_fix
When calling url_for with a hash, additional (likely unwanted) values (such as :host) would be returned in the hash
2011-08-11 19:55:48 -03:00
thedarkone
34c50895b4 Make use of the inherited initializer. 2011-07-28 20:18:54 +02:00
thedarkone
0753d0bd05 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:18:45 +02:00
Erik Michaels-Ober
c41ecd7164 Allow a route to have :format => true
When format is true, it is mandatory (as opposed to :format => false).
This is currently not possible with resource routes, which automatically
make format optional by default.
2011-07-25 11:46:52 -07:00
Dave Rogers
8a551086ec Ensure the constraints block is only applied to the correct route
addresses issue #1907 - any routes that follow a route with a constraints
  block are inheriting the previous route's constraints.
2011-07-25 10:40:40 -07:00
thedarkone
9395e89b72 Make polymorphic_url calls go through application helpers again.
This brings back the ability to overwrite/extend url generating methods in application heleprs.
2011-07-25 15:43:36 +02:00
Damien Mathieu
827e8a5983 provide a more explicit message when using url_for with nil
This fixes the problem of having a non-explicit message when the :location option is not provided in respond_with.
2011-07-03 02:13:53 +02:00
ganesh
b3ade0cc05 shallow_path example updated 2011-06-11 01:16:40 +02:00
Andrew White
89d7133082 Correct example and expand on description of :shallow option for resources 2011-05-21 07:11:47 +01:00
Xavier Noria
d491130236 Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/date_helper.rb
	railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
2011-05-14 11:21:27 +02:00
Xavier Noria
e5524d538c minor edits after going through what's new in docrails 2011-05-14 11:15:43 +02:00
Sebastian Martinez
ab880b9eb0 Follow code conventions on docs 2011-05-10 20:55:31 -03:00
James Miller
bb1af05247 Missing an end in routing docs 2011-05-09 18:46:07 -07:00
Sebastian Martinez
ed8962c821 more fixed-fonts here 2011-05-09 22:21:00 -03:00
José Valim
80bf68aa1b prepend the assets route instead of appending, closes #436 2011-05-08 12:59:04 +02:00
Jacob Poulsgaard Tjoernholm
9f9446f271 Update the description of the :path option to #resources to reflect that it sets the actual path, not a prefix. Most instances were already fixed. 2011-05-06 10:26:17 +02:00
Sebastian Martinez
9be7911e87 Use #remove_possible_method instead here 2011-05-04 15:13:40 -03:00
Josh Kalderimis
275529446e raise an error if the old router draw method is used, along with a message advising them to either upgrade their routes or add rails_legacy_mapper to their Gemfile 2011-05-03 16:07:25 +02:00
Piotr Sarnacki
820c0feda3 Explicitly define main_app proxy 2011-04-25 14:56:58 +02:00
Prem Sichanugrist
733bfa63f5 Remove #among? from Active Support
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?`.
2011-04-13 20:25:28 +08:00
David Heinemeier Hansson
d1575ae1b9 Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! 2011-04-12 00:23:07 +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
Prem Sichanugrist
51551a0a5b Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved]
After some discussion with Andrew White, it seems like this is a better approach for handling a wildcard route. However, user can still bring back the old behavior by supplying `:format => false` to the route.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-29 10:12:17 +01:00
Xavier Noria
3b91b3726d Merge branch 'master' of git://github.com/lifo/docrails 2011-03-23 21:52:33 +01:00
Prem Sichanugrist
2ddfdba9a0 Do not show optional (.:format) block for wildcard route [#6605 state:resolved]
This will make the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default
2011-03-22 09:19:40 -07:00
Gabriel Horner
61781d84c1 doc :anchor option for #match in routes 2011-03-15 09:23:17 -04:00
Aaron Patterson
9f2706d770 use a list to represent the supported verbs for a route object 2011-03-14 18:26:30 -07:00
Aaron Patterson
9ba2d422f5 stop splatting arguments so that we can understand wtf is going on 2011-03-14 16:17:05 -07:00
Aaron Patterson
833a90594e RegexpWithNamedGroups is only used for path_info, so only apply to path info 2011-03-14 15:17:29 -07:00
Aaron Patterson
acd4bfb537 Just define methods directly on the class rather than use the module
indirection.

clever--
2011-03-11 18:16:47 -08:00
Aaron Patterson
89c5b9aee7 do not automatically add format to routes that end in a slash 2011-03-11 18:06:22 -08:00
Aaron Patterson
0c777bace2 stop being clever and just call methods on the Route object 2011-03-08 16:18:27 -08:00
Andrew White
e00867bc43 Raise ArgumentError if route name is invalid [#6517 state:resolved] 2011-03-06 07:08:50 +00:00
R.T. Lechow
87e9e3f9af Action Pack typos. 2011-03-05 11:56:35 +01:00