From e90e6dc14289e5124f5867558667b374c3c3fbb3 Mon Sep 17 00:00:00 2001 From: David Eisinger Date: Mon, 7 Jul 2008 12:53:36 -0400 Subject: [PATCH] link_to helper now generates proper link when only a URL is passed in --- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- actionpack/test/template/url_helper_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index d5b7255..efe0508 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -210,7 +210,7 @@ module ActionView concat(link_to(capture(&block), options, html_options)) else name = args.first - options = args.second || {} + options = args.second || args.first html_options = args.third url = case options diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 3d5f7ea..302bdbe 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -81,6 +81,10 @@ class UrlHelperTest < ActionView::TestCase assert_dom_equal "Hello", link_to("Hello", "http://www.example.com") end + def test_link_tag_with_url_only + assert_dom_equal "http://www.example.com/weblog/show", link_to("http://www.example.com/weblog/show") + end + def test_link_tag_without_host_option ActionController::Base.class_eval { attr_accessor :url } url = {:controller => 'weblog', :action => 'show'} -- 1.5.4.3