Flowdock
method

fields_for_with_nested_attributes

Importance_0
fields_for_with_nested_attributes(association_name, args, block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/helpers/form_helper.rb, line 1001
        def fields_for_with_nested_attributes(association_name, args, block)
          name = "#{object_name}[#{association_name}_attributes]"
          association = @object.send(association_name)
          explicit_object = args.first if args.first.respond_to?(:new_record?)

          if association.is_a?(Array)
            children = explicit_object ? [explicit_object] : association
            explicit_child_index = args.last[:child_index] if args.last.is_a?(Hash)

            children.map do |child|
              fields_for_nested_model("#{name}[#{explicit_child_index || nested_child_index}]", child, args, block)
            end.join
          else
            fields_for_nested_model(name, explicit_object || association, args, block)
          end
        end
Register or log in to add new notes.