aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-08 11:50:08 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-08 11:50:08 -0800
commit3148ed9a4bb7efef30b846dc945d73ceebcc3f0f (patch)
tree6436ce8f07792aec3ec132fc4abb59d2a827cba7 /actionpack
parent772883c59078484dc8990ffbc509e249e22a6c84 (diff)
parentff3ab8a25f623d4ceb3ea189090879dc67693cb5 (diff)
downloadrails-3148ed9a4bb7efef30b846dc945d73ceebcc3f0f.tar.gz
rails-3148ed9a4bb7efef30b846dc945d73ceebcc3f0f.tar.bz2
rails-3148ed9a4bb7efef30b846dc945d73ceebcc3f0f.zip
Merge pull request #8115 from senny/7842_handle_trailing_slash_with_engines
handle trailing slash with engines (test case for #7842)
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb4
-rw-r--r--actionpack/test/dispatch/prefix_generation_test.rb5
2 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 045299281c..2311afc6c1 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -491,9 +491,7 @@ module ActionDispatch
prefix_options = options.slice(*_route.segment_keys)
# we must actually delete prefix segment keys to avoid passing them to next url_for
_route.segment_keys.each { |k| options.delete(k) }
- prefix = _routes.url_helpers.send("#{name}_path", prefix_options)
- prefix = '' if prefix == '/'
- prefix
+ _routes.url_helpers.send("#{name}_path", prefix_options)
end
end
end
diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb
index cfbf970a37..113608ecf4 100644
--- a/actionpack/test/dispatch/prefix_generation_test.rb
+++ b/actionpack/test/dispatch/prefix_generation_test.rb
@@ -241,6 +241,11 @@ module TestGenerationPrefix
assert_equal "/something/", app_object.root_path
end
+ test "[OBJECT] generating application's route includes default_url_options[:trailing_slash]" do
+ RailsApplication.routes.default_url_options[:trailing_slash] = true
+ assert_equal "/awesome/blog/posts", engine_object.posts_path
+ end
+
test "[OBJECT] generating engine's route with url_for" do
path = engine_object.url_for(:controller => "inside_engine_generating",
:action => "show",