method
fields_for
fields_for(record_or_name_or_array, *args, &block)
public
Hide source
# File actionpack/lib/action_view/helpers/form_helper.rb, line 748 def fields_for(record_or_name_or_array, *args, &block) if options.has_key?(:index) index = "[#{options[:index]}]" elsif defined?(@auto_index) self.object_name = @object_name.to_s.sub(/\[\]$/,"") index = "[#{@auto_index}]" else index = "" end case record_or_name_or_array when String, Symbol name = "#{object_name}#{index}[#{record_or_name_or_array}]" when Array object = record_or_name_or_array.last name = "#{object_name}#{index}[#{ActionController::RecordIdentifier.singular_class_name(object)}]" args.unshift(object) else object = record_or_name_or_array name = "#{object_name}#{index}[#{ActionController::RecordIdentifier.singular_class_name(object)}]" args.unshift(object) end @template.fields_for(name, *args, &block) end


