提交 06f2ec45 编写于 作者: A Aaron Patterson

pull stuff out of the caller and hide in the instance

上级 2cdbe227
......@@ -203,9 +203,9 @@ def url_else(t, args)
t.url_for(handle_positional_args(t, args, @options, @segment_keys))
end
def url_if(t, path)
def url_if(t, args)
@options.merge!(t.url_options) if t.respond_to?(:url_options)
@options[:path] = path
@options[:path] = eval("\"#{optimized_helper}\"")
ActionDispatch::Http::URL.url_for(@options)
end
......@@ -242,7 +242,6 @@ def define_url_helper(route, name, options)
helper = UrlHelper.create(route, options.dup)
ohelp = helper.optimize_helper?
ohelper = helper.optimized_helper
arg_size = route.required_parts.size
@module.module_eval do
......@@ -250,7 +249,7 @@ def define_url_helper(route, name, options)
#helper.call t, args
if ohelp && args.size == arg_size && !args.last.is_a?(Hash) && optimize_routes_generation?
helper.url_if(self, eval("\"#{ohelper}\""))
helper.url_if(self, args)
else
helper.url_else(self, args)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册