• A
    Refactor handling of :action default in routing · 8ca8a2d7
    Andrew White 提交于
    The longstanding convention in Rails is that if the :action parameter
    is missing or nil then it defaults to 'index'. Up until Rails 5.0.0.beta1
    this was handled slightly differently than other routing defaults by
    deleting it from the route options and adding it to the recall parameters.
    
    With the recent focus of removing unnecessary duplications this has
    exposed a problem in this strategy - we are now mutating the request's
    path parameters and causing problems for later url generation. This will
    typically affect url_for rather a named url helper since the latter
    explicitly pass :controller, :action, etc.
    
    The fix is to add a default for :action in the route class if the path
    contains an :action segment and no default is passed. This change also
    revealed an issue with the parameterized part expiry in that it doesn't
    follow a right to left order - as soon as a dynamic segment is required
    then all other segments become required.
    
    Fixes #23019.
    8ca8a2d7
route_set.rb 22.8 KB