From 613dd5fda2cf1a413c58649275a9accb32305252 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 21 Apr 2010 01:33:48 -0300 Subject: [PATCH] url_for now works with HashWithIndifferentAccess ht jay [#4391 state:committed] --- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- actionpack/test/template/url_helper_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 4ffc5ea..13a54b0 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -102,7 +102,7 @@ module ActionView escape = true options when Hash - options = { :only_path => options[:host].nil? }.update(options.symbolize_keys) + options = { :only_path => options[:host].nil? }.update(options.to_hash.symbolize_keys) escape = options.key?(:escape) ? options.delete(:escape) : false super when :back diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 4474949..314ed91 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -421,6 +421,11 @@ class UrlHelperControllerTest < ActionController::TestCase render :inline => "<%= url_for :controller => 'url_helper_controller_test/url_helper', :action => 'show_url_for' %>" end + def show_overriden_url_for + params = { :controller => 'c', :action => 'a' } + render :inline => "<%= url_for params.merge(:controller => 'url_helper_controller_test/url_helper', :action => 'show_url_for') %>" + end + def show_named_route render :inline => "<%= show_named_route_#{params[:kind]} %>" end @@ -439,6 +444,11 @@ class UrlHelperControllerTest < ActionController::TestCase assert_equal '/url_helper_controller_test/url_helper/show_url_for', @response.body end + def test_overriden_url_for_shows_only_path + get :show_overriden_url_for + assert_equal '/url_helper_controller_test/url_helper/show_url_for', @response.body + end + def test_named_route_url_shows_host_and_path get :show_named_route, :kind => 'url' assert_equal 'http://test.host/url_helper_controller_test/url_helper/show_named_route', -- 1.7.0