Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 35d25b9

Browse files
committed
use while instead of #map
Callbacks array could be modified during #map. This cause errors in jruby and rubinius.
1 parent 78cd7c9 commit 35d25b9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/nested_form/view_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ def after_nested_form(association, &block)
3333
private
3434
def after_nested_form_callbacks
3535
@after_nested_form_callbacks ||= []
36-
fields = @after_nested_form_callbacks.map do |callback|
37-
callback.call
36+
fields = []
37+
while callback = @after_nested_form_callbacks.shift
38+
fields << callback.call
3839
end
3940
fields.join(" ").html_safe
4041
end

0 commit comments

Comments
 (0)