提交 3148ed9a 编写于 作者: R Rafael Mendonça França

Merge pull request #8115 from senny/7842_handle_trailing_slash_with_engines

handle trailing slash with engines (test case for #7842)
......@@ -491,9 +491,7 @@ def define_generate_prefix(app, name)
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
......
......@@ -241,6 +241,11 @@ def setup
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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册