diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-17 23:45:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-17 23:45:42 +0000 |
commit | db083299465bdb89297e180e9635d4ea102c8e19 (patch) | |
tree | 01d3ac3b40f66d90fb8d9ff0ef03cff8e6056362 /actionpack/lib/action_controller | |
parent | 3c0fd445c0a36c36cbd8c4259a28a978a8e8eb83 (diff) | |
download | rails-db083299465bdb89297e180e9635d4ea102c8e19.tar.gz rails-db083299465bdb89297e180e9635d4ea102c8e19.tar.bz2 rails-db083299465bdb89297e180e9635d4ea102c8e19.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/polymorphic_routes.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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) |