Permalink
Browse files

pull stuff out of the caller and hide in the instance

  • Loading branch information...
tenderlove committed Jan 25, 2013
1 parent 2cdbe22 commit 06f2ec4530ccf28a3da67b037b541d34ecef4658
Showing with 3 additions and 4 deletions.
  1. +3 −4 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -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,15 +242,14 @@ 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
define_method(name) do |*args|
#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

0 comments on commit 06f2ec4

Please sign in to comment.