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

Changeset 4998

Show
Ignore:
Timestamp:
09/04/06 20:09:15 (2 years ago)
Author:
david
Message:

Fixed default routing NoMethodError downcase for nil when default controller provided (closes #5400) [kajism@yahoo.com]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/routing.rb

    r4763 r4998  
    557557 
    558558      def match_extraction(next_capture) 
    559         hangon = (default ? "|| #{default.inspect}" : "if match[#{next_capture}]") 
    560         "params[:#{key}] = match[#{next_capture}].downcase #{hangon}" 
     559        if default 
     560          "params[:#{key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{default}'" 
     561        else 
     562          "params[:#{key}] = match[#{next_capture}].downcase if match[#{next_capture}]" 
     563        end 
    561564      end 
    562565    end 
  • trunk/actionpack/test/controller/routing_test.rb

    r4907 r4998  
    12871287  end 
    12881288 
     1289  def test_draw_default_route_with_default_controller 
     1290    ActionController::Routing.with_controllers(['users']) do 
     1291      set.draw do |map| 
     1292        map.connect '/:controller/:action/:id', :controller => 'users' 
     1293      end       
     1294      assert_equal({:controller => 'users', :action => 'index'}, set.recognize_path('/')) 
     1295    end 
     1296  end 
     1297 
    12891298  def test_route_with_parameter_shell 
    12901299    ActionController::Routing.with_controllers(['users', 'pages']) do