Skip to content

Commit

Permalink
Fixed proc call when form with new record was initialized
Browse files Browse the repository at this point in the history
As I guess from `FormDefinition#initialize`, `proc` is never set.

In my case, it was always `nil` and for new records, the code evaluated `form.instance_eval(&proc)` where `proc` was nil. That lead to `ArgumentError: wrong number of arguments (0 for 1..3)`.
  • Loading branch information
kirs committed Sep 17, 2014
1 parent 097f3ef commit 9ab87af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/active_form/form_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def aggregate_form_errors

def fetch_models
associated_records = parent.send(association_name)

associated_records.each do |model|
form = Form.new(association_name, parent, proc, model)
forms << form
form.instance_eval &proc
form.instance_eval(&proc) if proc.present?
end
end

Expand Down Expand Up @@ -178,4 +178,4 @@ def create_form
end
end

end
end

0 comments on commit 9ab87af

Please sign in to comment.