Skip to content

Non-nested fields_for #283

@ploomans

Description

@ploomans

Currently you can use fields_for to create a nested form like this:

<%= bootstrap_form_for @person do |person_form| %>
<%= person_form.fields_for @person.address do |address_fields| %>
<%= address_fields.text_field :street %>
<% end %>
<%= person_form.submit %>
<% end %>

This way the input :street wil get the name person[address][street]. I would like that it get the name address[street] so not nested inside person

Using the Rails form helper you would do this by changing "person_form.fields_for" to simply "fields_for" (which works like form_for but without the creation of enclosing form tags)

However bootstrap_fields_for or something similar does not seem to exist.

Is there maybe an option you can pass to bootstrap_form_for so that it will not output the form tags?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions