Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

field_with_errors div not displayed for nested model form attributes

#5212

Hello,

In Rails 3 RC, validation errors are collected correctly in the errors array, and displayed in the view for both parent and child model associations, when using 'accepts_nested_attributes_for'. However, whilst 'field_with_errors' div tags are generated around parent form fields, they are not generated for nested child form fields.

It's not clear to me if this is a bug... or perhaps it is intentionally (by design) not supported in Rails.

Could somebody confirm if this is expected behaviour?

-- Scott

Scott Lowe

Reported by Scott Lowe · July 27th, 2010 @ 01:18 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. rorra
    rorra

    Its working ok for me with rails 3 RC and ruby 1.9.2 RC 2

    Could you attach your code so I can reproduce the error and confirm the bug?

    Thx

    July 27th, 2010 @ 09:15 PM

  2. Scott Lowe
    Scott Lowe

    Hi Rorra,

    Good news! I produced an isolated test app and it turns out that there was a mistake in the complexity of my association, and my fields_for symbol.

    I am sorry to have raised a false alarm, but at least something good came out of this - the exercise has reminded me of the importance of submitting bug reports with a good test case, so at least next time I submit a bug, I will give you a report that's been more rigorously investigated in isolation, and you can be more assured of it's significance.

    Please close this report (Loving Rails 3 RC, btw).

    Kind regards,

    -- Scott

    July 27th, 2010 @ 10:55 PM

  3. rorra
    rorra
    • Tag changed from rails3 validations, accepts_nested_attributes_for, field_with_errors to rails3 validations, accepts_nested_attributes_for, field_with_errors, invalid

    July 27th, 2010 @ 11:06 PM

  4. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to invalid
    • Importance changed from to Low

    July 28th, 2010 @ 10:22 AM