This project is archived and is in readonly mode.
AD::Routing::Mapper#apply_common_behavior_for: Hash modification during iteration
Reported by Nick Sieger | August 20th, 2010 @ 09:56 PM
The following code fails on JRuby and is bad style and unreliable in general:
options.each do |k,v|
(options[:constraints] ||= {})[k] = options.delete(k) if options[k].is_a?(Regexp)
end
The failure is as shown in JRuby's CI build:
http://ci.jruby.org/view/Rails/job/rails-master-actionpack-jruby/23...
/Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:778:in `apply_common_behavior_for': can't add a new key into hash during iteration (RuntimeError)
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:777:in `each'
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:777:in `apply_common_behavior_for'
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:602:in `resources'
from ./test/dispatch/routing_test.rb:229
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:357:in `scope'
from ./test/dispatch/routing_test.rb:228
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:376:in `namespace'
from /Users/nicksieger/Projects/ruby/rails/actionpack/lib/action_dispatch/routing/mapper.rb:357:in `scope'
... 14 levels...
from /Users/nicksieger/.rvm/gems/jruby-head@rails-test/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Users/nicksieger/.rvm/gems/jruby-head@rails-test/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /Users/nicksieger/.rvm/gems/jruby-head@rails-test/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
Patch attached.
Comments and changes to this ticket
-
Nick Sieger August 20th, 2010 @ 10:00 PM
- Tag set to 3.0.0.rc, tiny
Patch attached for 3-0-stable and master.
-
Repository August 20th, 2010 @ 10:27 PM
(from [2277c51555249cc8b0478e175bcb744841634db5]) Fix hash modification during iteration in Mapper [#5420]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
http://github.com/rails/rails/commit/2277c51555249cc8b0478e175bcb74... -
Repository August 20th, 2010 @ 10:28 PM
(from [b4a520874a84c8364308f73bcad5833a63854835]) Fix hash modification during iteration in Mapper [#5420]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
http://github.com/rails/rails/commit/b4a520874a84c8364308f73bcad583... -
Santiago Pastorino August 20th, 2010 @ 10:29 PM
- State changed from new to committed
- Importance changed from to Low
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5420 AD::Routing::Mapper#apply_common_behavior_for: Hash modification during iteration (from [2277c51555249cc8b0478e175bcb744841634db5]) Fix has...
- 5420 AD::Routing::Mapper#apply_common_behavior_for: Hash modification during iteration (from [b4a520874a84c8364308f73bcad5833a63854835]) Fix has...