This project is archived and is in readonly mode.

#5212 ✓invalid
Scott Lowe

field_with_errors div not displayed for nested model form attributes

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


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

Comments and changes to this ticket

  • rorra

    rorra July 27th, 2010 @ 09:15 PM

    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?


  • Scott Lowe

    Scott Lowe July 27th, 2010 @ 10:55 PM

    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

  • rorra

    rorra July 27th, 2010 @ 11:06 PM

    • Tag changed from rails3 validations, accepts_nested_attributes_for, field_with_errors to rails3 validations, accepts_nested_attributes_for, field_with_errors, invalid
  • Rohit Arondekar

    Rohit Arondekar July 28th, 2010 @ 10:22 AM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>