diff --git a/lib/active_form/form_collection.rb b/lib/active_form/form_collection.rb index fe2f5cc..65cf92e 100644 --- a/lib/active_form/form_collection.rb +++ b/lib/active_form/form_collection.rb @@ -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 @@ -146,7 +146,7 @@ def initialize_models records.times do form = Form.new(association_name, parent, proc) forms << form - form.instance_eval &proc + form.instance_eval(&proc) if proc.present? end end @@ -178,4 +178,4 @@ def create_form end end -end \ No newline at end of file +end