Validation and error messages in has_many association in single form with parent

I am having trouble with validation and user-friendly error messages
when I create a new "Spot" and an associated (has_many) "Title".

I have the following models:

NickCB wrote:

First, the title is being validated, which is good, but I don't have
to include a validates_associated call in the Spot model like I would
if this was a has_one relationship. Why is that?

Second, when there is an error in the title field, error_messages_for
(:object => [@spot.titles[0], @spot]) displays two errors, the first
one is what I expect "The Title cannot be blank." but I also get an
additional error "Titles is invalid." This error is part of the @spot
object. I would like to be able to remove this message, because it is
a duplicate, and because I don't know where to change the verbiage to
something more user friendly.

Active Record does automatic internal validation of has_many associations.
You can turn it off by putting

   def validate_associated_records_for_titles() end

after the has_many call. You can then add your own validates_associated
call with your own error message. Call validates_associated with
:message => nil if you want no error message displayed for the parent
object.