Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9053

Show
Ignore:
Timestamp:
03/17/08 23:45:42 (2 months ago)
Author:
david
Message:

Fixed that polymorphic routes would modify the input array (closes #11363) [thomas.lee]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r9052 r9053  
    11*SVN* 
     2 
     3* Fixed that polymorphic routes would modify the input array #11363 [thomas.lee] 
    24 
    35* Added :format option to NumberHelper#number_to_currency to enable better localization support #11149 [lylo] 
  • trunk/actionpack/lib/action_controller/polymorphic_routes.rb

    r8741 r9053  
    6969    # 
    7070    def polymorphic_url(record_or_hash_or_array, options = {}) 
     71      if record_or_hash_or_array.kind_of?(Array) 
     72        record_or_hash_or_array = record_or_hash_or_array.dup 
     73      end 
     74 
    7175      record    = extract_record(record_or_hash_or_array) 
    7276      format    = (options[:action].to_s == "formatted" and record_or_hash_or_array.pop) 
  • trunk/actionpack/test/controller/polymorphic_routes_test.rb

    r8880 r9053  
    126126    end 
    127127 
     128    def test_polymorphic_path_does_not_modify_arguments 
     129      expects(:admin_article_responses_url).with(@article) 
     130      path = [:admin, @article, @response] 
     131      assert_no_difference 'path.size' do 
     132        polymorphic_url(path) 
     133      end 
     134    end 
    128135  end 
    129136end