From 0b02f9cb1d9711614b5a00956331c9f2bca838b7 Mon Sep 17 00:00:00 2001 From: Clemens Kofler Date: Sat, 19 Jul 2008 01:08:08 +0200 Subject: [PATCH] Removed handling of string parameter in link_to to have all URL generation in one place since string parameter is handled in url_for anyway. --- actionpack/lib/action_view/helpers/url_helper.rb | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 94e1f1d..0abd003 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -65,13 +65,15 @@ module ActionView def url_for(options = {}) options ||= {} case options + when String + escape = true + url = options when Hash options = { :only_path => options[:host].nil? }.update(options.symbolize_keys) escape = options.key?(:escape) ? options.delete(:escape) : true url = @controller.send(:url_for, options) - when String - escape = true - url = options + when :back + url = @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()' else escape = false url = polymorphic_path(options) @@ -211,14 +213,7 @@ module ActionView options = args.second || {} html_options = args.third - url = case options - when String - options - when :back - @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()' - else - self.url_for(options) - end + url = self.url_for(options) if html_options html_options = html_options.stringify_keys -- 1.5.2.4