Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use while instead of #map

Callbacks array could be modified during #map. This cause errors in
jruby and rubinius.
  • Loading branch information...
commit 35d25b93bd2e68b61f5be74d92880be76d4af7cd 1 parent 78cd7c9
@lest lest authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/nested_form/view_helper.rb
View
5 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
Please sign in to comment.
Something went wrong with that request. Please try again.