I have a form that has a user model and an array of todo models. I'm
trying to figure out how to do the validation with rails correctly.

the user part is no problem, but for the array of todo models, the
errors aren't being displayed back.

in the Todo validate method, I do some logic to see if certain columns
are defined and an errors.add_to_base call.

I know each validate works in the model because i did a debugger and
'p errors' which shows the error for the corresponding todo model.

How does Rails handle errors for multiple objects of the same model?

In the view, i tried error_messages_for :todo and :todos

In the controller, i process the todo each separately.

The only way i can get it to work is to do:
      todo.validate
      raise "error for todo" if todo.errors

This is a less than ideal solution since it'll only show one error at
a time.

Any ideas?
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
sdruby@googlegroups.com
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to