Skip to content
Browse files

url_for now works with HashWithIndifferentAccess ht jay [#4391 state:…

…committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 726b5d7 commit 5c9c30ac65d25bd5a83d773739c2cd8fdd6da4d3 @spastorino spastorino committed with jeremy Apr 21, 2010
Showing with 11 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_view/helpers/url_helper.rb
  2. +10 −0 actionpack/test/template/url_helper_test.rb
View
2 actionpack/lib/action_view/helpers/url_helper.rb
@@ -102,7 +102,7 @@ def url_for(options = {})
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
View
10 actionpack/test/template/url_helper_test.rb
@@ -421,6 +421,11 @@ def show_url_for
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 @@ def test_url_for_shows_only_path
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',

0 comments on commit 5c9c30a

Please sign in to comment.
Something went wrong with that request. Please try again.