This project is archived and is in readonly mode.

#794 ✓wontfix

map.resources does not work well when multiple entities provided

Reported by dazuiba | August 11th, 2008 @ 02:18 AM | in 2.x

when I write routes like this in routes.rb

map.resources :books,:users,:requirements=>{:id => /\d+/}

the requirements only work for ":books"---the first entitiy provided.

The "hash shallow copy" arose this bug. (:requirements=>{:id => /\d+/} is a nested hash)

code from actionpack\lib\actioncontroller\resources.rb

def resource(*entities, &block)
  options = entities.extract_options!
  entities.each { |entity| map_singleton_resource(entity, options.dup, &block) }

I mean that , we should pass a deep copy of options to method "map_singleton_resource", not "options.dup" which is shallow copy.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket