From db083299465bdb89297e180e9635d4ea102c8e19 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 17 Mar 2008 23:45:42 +0000 Subject: Fixed that polymorphic routes would modify the input array (closes #11363) [thomas.lee] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9053 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/polymorphic_routes.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_controller/polymorphic_routes.rb') diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb index ec883af26d..f043d89dae 100644 --- a/actionpack/lib/action_controller/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/polymorphic_routes.rb @@ -68,6 +68,10 @@ module ActionController # polymorphic_url(record) #-> comments_url() # def polymorphic_url(record_or_hash_or_array, options = {}) + if record_or_hash_or_array.kind_of?(Array) + record_or_hash_or_array = record_or_hash_or_array.dup + end + record = extract_record(record_or_hash_or_array) format = (options[:action].to_s == "formatted" and record_or_hash_or_array.pop) namespace = extract_namespace(record_or_hash_or_array) -- cgit v1.2.3