diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-25 09:43:04 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-30 10:24:57 -0800 |
commit | 44dd44ad7018badf4fe95f93675af2a6d5587df4 (patch) | |
tree | 179e835e144b20261e0b780d0409099003abd110 /actionpack/lib/action_dispatch/routing | |
parent | fc8f45a3c168ed5f0bc859e9f3a64e61cfe4b50a (diff) | |
download | rails-44dd44ad7018badf4fe95f93675af2a6d5587df4.tar.gz rails-44dd44ad7018badf4fe95f93675af2a6d5587df4.tar.bz2 rails-44dd44ad7018badf4fe95f93675af2a6d5587df4.zip |
moved more evald code
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index b3a85be8aa..e9837c6ca8 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -172,6 +172,12 @@ module ActionDispatch t.url_for(handle_positional_args(t, args, options, seg)) end + def url_if(t, options, path) + options.merge!(t.url_options) if t.respond_to?(:url_options) + options[:path] = path + ActionDispatch::Http::URL.url_for(options) + end + def handle_positional_args(t, args, options, segment_keys) inner_options = args.extract_options! result = options.dup @@ -192,17 +198,10 @@ module ActionDispatch def define_url_helper(route, name, options) @module.remove_possible_method name @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1 - - def if_#{name}(t, options, path) - options.merge!(url_options) if t.respond_to?(:url_options) - options[:path] = path - ActionDispatch::Http::URL.url_for(options) - end - def #{name}(*args) if #{optimize_helper?(route)} && args.size == #{route.required_parts.size} && !args.last.is_a?(Hash) && optimize_routes_generation? options = #{options.inspect} - if_#{name}(self, options, "#{optimized_helper(route)}") + UrlHelp.new.url_if(self, options, "#{optimized_helper(route)}") else UrlHelp.new.url_else(self, args, #{options.inspect}, #{route.segment_keys.inspect}) end |