Validation error reporting on child object


#1

How does one deal with validation error messages on child objects of the
main model object
behind a page?

I have the basic blog w/ comments page (only my “entry” is a
“proposal”). I have the
comments saving just fine, but I wanted to show an error if the user
hits the submit
button without typing anything in the comment.

I added “validates_presence_of :comment_text” in my Comment AR class,
and it appears that
the empty comment is no longer being inserted into the db. However, I
can’t figure out how
to display the error message on the comment object (1 to M child of
proposal) in the page.

I put an “else” on the call to save the comment in my add_comment action
and that is getting called, but
I can’t figure out where the error message going. Looked at
@proposal.comments.inspect
in the view, I don’t see an error message.

thanks,

b