justinfrench/formtastic — Issue #786: flatten in inputs_for_nested_attributes should have a level
Author: eLod
Created: 2012-01-30 05:53:31+00:00
State: open

`inputs_for_nested_attributes` does a `fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten` (i'm using 1.x but 2.x is the same), which will swallow an empty array. so if i do `inputs :for => [:association, []]` (meaning i want to have an empty list not the current association list, but still have the 'bindings' for inputs and labels) the `flatten` will simply swallow the empty array. the solution would be to use `flatten(1)`. my goal is to create a `has_many` list (input) that the user can only use to add new items (e.g. the associated objects would be further processed upon submit, so though i need to have/process the associated objects i don't want to show/list them to the user afterwards), not sure if i overlooked something.