Permalink
Browse files

use while instead of #map

Callbacks array could be modified during #map. This cause errors in
jruby and rubinius.
  • Loading branch information...
1 parent 78cd7c9 commit 35d25b93bd2e68b61f5be74d92880be76d4af7cd @lest lest committed Jul 9, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/nested_form/view_helper.rb
@@ -33,8 +33,9 @@ def after_nested_form(association, &block)
private
def after_nested_form_callbacks
@after_nested_form_callbacks ||= []
- fields = @after_nested_form_callbacks.map do |callback|
- callback.call
+ fields = []
+ while callback = @after_nested_form_callbacks.shift
+ fields << callback.call
end
fields.join(" ").html_safe
end

0 comments on commit 35d25b9

Please sign in to comment.