aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-16 16:44:02 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-16 16:44:02 -0300
commit5284bbbe1e4c46d226202b71015d3ab8539751f3 (patch)
tree057d963ca9dc593209636115418f5b64a953969d /actionpack/lib
parent9bbb3ca3066fc5dbaeddad97d995dbe435d0a031 (diff)
parent41679b2b31f88de2bf176197d883bc95dcb0a2f2 (diff)
downloadrails-5284bbbe1e4c46d226202b71015d3ab8539751f3.tar.gz
rails-5284bbbe1e4c46d226202b71015d3ab8539751f3.tar.bz2
rails-5284bbbe1e4c46d226202b71015d3ab8539751f3.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 1ee74e6810..d24751d28d 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -155,8 +155,8 @@ module ActionDispatch
@arg_size = @required_parts.size
end
- def call(t, args)
- if args.size == arg_size && !args.last.is_a?(Hash) && optimize_routes_generation?(t)
+ def call(t, args, inner_options)
+ if args.size == arg_size && !inner_options && optimize_routes_generation?(t)
options = t.url_options.merge @options
options[:path] = optimized_helper(args)
ActionDispatch::Http::URL.url_for(options)
@@ -207,15 +207,19 @@ module ActionDispatch
@route = route
end
- def call(t, args)
+ def call(t, args, inner_options)
controller_options = t.url_options
options = controller_options.merge @options
- hash = handle_positional_args(controller_options, args, options, @segment_keys)
+ hash = handle_positional_args(controller_options,
+ inner_options || {},
+ args,
+ options,
+ @segment_keys)
+
t._routes.url_for(hash)
end
- def handle_positional_args(controller_options, args, result, path_params)
- inner_options = args.extract_options!
+ def handle_positional_args(controller_options, inner_options, args, result, path_params)
if args.size > 0
if args.size < path_params.size - 1 # take format into account
@@ -251,7 +255,9 @@ module ActionDispatch
@module.remove_possible_method name
@module.module_eval do
define_method(name) do |*args|
- helper.call self, args
+ options = nil
+ options = args.pop if args.last.is_a? Hash
+ helper.call self, args, options
end
end