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) }
end
I mean that , we should pass a deep copy of options to method "map_singleton_resource", not "options.dup" which is shallow copy.