Commit Graph

40 Commits

Author SHA1 Message Date
Aaron Patterson
798a14a638 pass a config to the route set
This way we can get the relative_url_root from the application without
setting another global value
2015-03-05 13:12:06 -08:00
Yasyf Mohamedali
6c14252d2c Fallback to RAILS_RELATIVE_URL_ROOT in url_for.
Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment
variable is not prepended to the path when `url_for` is called.
If `SCRIPT_NAME` (used by Rack) is set, it takes precedence.
2015-02-24 16:04:27 -05:00
Santiago Pastorino
d3dafaa0b3 Merge branch 'nil_script_name' 2014-11-25 10:31:26 -02:00
Santiago Pastorino
ad973ab8a0 Add regression test case to ensure script_name as nil is not used anymore in url_for 2014-11-25 10:29:48 -02:00
Guo Xiang Tan
46041c5208 Anchor should not be appended when set to nil/false.
Fixes https://github.com/rails/rails/issues/17714.
2014-11-23 08:23:26 +08:00
Godfrey Chan
6625000b73 Remove useless only_path: true in path helpers
We added a deprecation warning for these cases in aa1fadd, so these are now
causing deprecation warnings in the test output. AFAICT, in these two cases, the
option is not integral to the purpose of the test, so they can be safely removed
2014-11-10 00:47:25 -08:00
Akira Matsuda
b30b99c615 Expectations first 2014-08-18 15:40:53 +09:00
Aaron Patterson
a9765c54ea helper methods are public, so we can just call them
also if you want a path from a named helper, you should call
helper_path, not helper_url(:only_path => true).
2014-07-17 10:04:52 -07:00
Aaron Patterson
caf1bfccc6 use Ruby for mocking 2014-06-12 09:19:59 -07:00
Aaron Patterson
62d1b330c4 Revert "Rewrite journey routes formatter for performance"
This reverts commit 5c224de9e110763ec7a0f01f5b604bcf81f40bfb.

Conflicts:
	actionpack/lib/action_dispatch/journey/visitors.rb

5c224de9e110763ec7a0f01f5b604bcf81f40bfb introduced a bug in the
formatter.  This commit includes a regression test.
2014-05-19 16:14:47 -07:00
Guilherme Cavalcanti
be93d94ef2 ActionDispatch::Http::URL.normalize_port should not strip port for protocol relative URL. 2014-05-11 12:59:37 +01:00
Zachary Scott
dfe9cf1ace Remove outdated TODO from url_for test, this test was fixed in 900a2d30 2014-02-09 04:20:56 +02:00
Andrey Ognevsky
d04c4fac3b Take Hash with options inside Array in #url_for 2013-11-15 15:50:42 +04:00
Derek Watson
6183e1a460 Passing subdomain: '' to url_for removes the subdomain (instead of adding a leading .)
Adding a boolean route constraint checks for presence/absence of request property
2013-04-18 17:12:40 +01:00
Akira Matsuda
c8e632bd9f Namespace HashWithIndifferentAccess 2013-01-07 07:37:23 +09:00
Rafael Mendonça França
82667c84e1 Remove warning renaming the test classes to use the test convention 2012-07-29 17:47:05 -03:00
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
Santiago Pastorino
500c9a161c Revert "Merge pull request #5750 from ahoward/master"
This reverts commit 174cf8b22064c3999dfa685014d5b31ac993bb54, reversing
changes made to 7ecd6a731bd60665bc6de94095137f0b2c4ada2a.
The reverted commit improved the performance in the wrong place, now we
have added this 6ddbd1844a6fd6aca2992f5f75c9f605cf89808f improvement.
2012-04-08 22:44:37 -03:00
Rafael Mendonça França
ddbd1e4adb Make url_for work when option is nil and default_url_options has
stringified keys
2012-04-05 15:14:00 -03:00
ara.t.howard
697991a201 carefully and quickly merge url_for options 2012-04-04 16:28:19 -06:00
Aaron Suggs
0c525f68f2 Add test for default_url_options[:port] 2012-03-28 13:31:37 +02:00
choonkeat
5f67cfeda1 Fix url_for options[:subdomain] to allow objects as values
* e.g. blog_url(subdomain: current_user) instead of blog_url(subdomain: current_user.to_param)
2011-12-14 22:43:42 +08:00
Bradford Folkens
bd559b0068 Fix trouble using :subdomain in development environment when using numeric addresses.
See-also pull request #3561 from 3-1-stable

    Otherwise the following occurs:

    TypeError: can't convert nil into String
        /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:75:in host_or_subdomain_and_domain'
        /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/http/url.rb:37:in url_for'
        /Users/bfolkens/dev/bfolkens-rails-core/actionpack/lib/action_dispatch/routing/url_for.rb:147:in test_subdomain_may_be_accepted_with_numeric_host'
        /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in run'
        /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:426:in send'
        /Users/bfolkens/dev/bfolkens-rails-core/activesupport/lib/active_support/callbacks.rb:81:in run'
2011-11-08 07:52:35 -06:00
Kamil Sobieraj
de942e5534 :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 #2025 2011-10-04 09:16:34 +01:00
Neeraj Singh
6688b6393a expected message should come first 2011-06-11 03:11:06 -04:00
Andrew White
03cbd9672c Filter params that return nil for to_param and allow through false values 2011-03-09 14:44:25 +00:00
Stephen Celis
a0757e00f3 Protocol-relative URL support.
[#5774 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-02 19:09:44 -02:00
Josh Kalderimis
2fe43b694f :subdomain, :domain and :tld_length options can now be used in url_for, allowing for easy manipulation of the host during link generation.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-23 09:54:42 +01:00
Emilio Tagua
2d274a5208 Use parentheses when using assert_match followed by a regexp to avoid warnings. 2010-09-27 11:19:19 -03:00
Łukasz Strzałkowski
8659c5e657 Fixed url_for test
Added route which matches all: controller, action, id and format
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
Piotr Sarnacki
f7ba614c2d Unify routes naming by renaming router to routes
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-02 01:51:03 +02:00
Andrew White
bba19603c2 URL fragments should not have safe characters escaped. Ref: Appendix A, http://tools.ietf.org/rfc/rfc3986.txt
[#4762 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 18:05:40 -07:00
Santiago Pastorino
920df0a475 Make ActionDispatch url_for use HWIA symbolize_keys
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-22 09:06:55 -07:00
J Smith
275e839b8d Ensure that url_for uses symbolized keys in the controller. [#4391]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-22 16:47:36 +02:00
Carlhuda
900a2d304a Get rid of relative_url_path in favor of respecting SCRIPT_NAME. Also added a way to specify a default SCRIPT_NAME when generating URLs out of the context of a request. 2010-03-04 17:43:46 -08:00
Carlhuda
bcfb77782b Work on deprecating ActionController::Base.relative_url_root 2010-03-03 15:49:52 -08:00
Carlhuda
ab0cc7286f Setting UrlFor in with_routing is no longer needed now that it's not global 2010-02-26 15:56:38 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
José Valim
3f84091937 ActionMailer should depend just on AbstractController. 2010-01-29 17:51:05 +01:00