I can''t get the field_with_errors div''s to wrap around nested fields in a fields_for block when using a custom validation method in the parent model. e.g. there needs to be at least one order detail record associated with an order. I add the error to the parent model errors hash however I can''t get the key to match the form field so that the wrapping div''s get applied. This does work for local attributes and for validation in the actual nested model. Can anybody tell me how to get the keys in the error''s hash to match the nested fields in my form? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/qcC1e2wZEzMJ. For more options, visit https://groups.google.com/groups/opt_out.
Never mind I figured this out. On Friday, November 2, 2012 12:26:41 PM UTC-4, Benny wrote:> > I can''t get the field_with_errors div''s to wrap around nested fields in a > fields_for block when using a custom validation method in the parent model. > e.g. there needs to be at least one order detail record associated with an > order. I add the error to the parent model errors hash however I can''t get > the key to match the form field so that the wrapping div''s get applied. > This does work for local attributes and for validation in the actual nested > model. Can anybody tell me how to get the keys in the error''s hash to match > the nested fields in my form? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/kptP_WaVxhYJ. For more options, visit https://groups.google.com/groups/opt_out.
Maybe Matching Threads
- Nested forms validation problem
- 2.3 Nested Model Forms; build new without updating existing
- field_with_errors.
- Best way to instanciate an empty address element in many nested fields_for
- how to get form parameters while using fields_for with nested attributes