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

Ticket #7047: fix_url_for_behavior_with_arrays.diff

File fix_url_for_behavior_with_arrays.diff, 1.2 kB (added by jeremymcanally, 2 years ago)
  • actionpack/test/controller/routing_test.rb

    old new  
    9090      puts "#{1 / per_url} url/s\n\n" 
    9191    end 
    9292  end 
     93   
     94  def test_route_with_array_param 
     95    assert_equal '/people/visit?array[]=1&array[]=2&array[]=3', rs.generate({:controller => 'people', :action => 'visit', :array => [1,2,3]}) 
     96  end 
    9397 
    9498  def test_route_with_colon_first 
    9599    rs.draw do |map| 
  • actionpack/lib/action_controller/routing.rb

    old new  
    11791179 
    11801180        options_as_params = options[:controller] ? { :action => "index" } : {} 
    11811181        options.each do |k, value| 
    1182           options_as_params[k] = value.to_param 
     1182          # We should treat Array's properly, but only if they're not the path 
     1183          options_as_params[k] = (value.class == Array && k.to_s != 'path') ? value : value.to_param 
    11831184        end 
    11841185        options_as_params 
    11851186      end