Skip to content

Nested forms #99

Open
Open
@ujifgc

Description

@ujifgc

From @fgarcia on September 9, 2014 14:37

I am not having the behavior I expected from the fields_for form helper. This is what I am trying to do (Slim template):

= form_tag '/form/posted' do

  = fields_for :model do |f|
    = f.label :email
    = f.text_field :email

The text field above is generated as:

<input type="text" name="object[email]" value="" id="object_email">

I expected the field to be inside 'model', not inside 'object':

<input type="text" name="model[email]" value="" id="object_email">

Also I cannot nest again inside like this:

= f.fields_for :inside do |ff|
  = ff.text_field :bar

With that I get the error undefined method 'inside' and my expected output was:

<input type="text" name="model[inside][bar]"  id="...">

Maybe I am doing something wrong expecting something similar to the rails helpers, so any advice using these helpers to get nested forms (without object) would be welcome.

Copied from original issue: padrino/padrino-framework#1760

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions