validation on a has_many relationship

flash[:error] = @request.errors.full_messages.join(', ')

Hi     That is correct I get the same result when use @request.errors.each{}       But my problem is when email and name blank, I dont get the error message flash as

Name should not be blank Email should not be blank

   but I get error like

     contacts is invalid

   But if suppose my request model too has a validation like validates_presence_of :reason, :message => 'Reason should not be blank'

     I get the whole flash[error] like

   Reason should not be blank    contacts is invalid

      Why the individual error messages of contact model not appearing?

Sijo

You need to get the contact's errors from the contact. Try this out:

      @request = Request.new(params[:request])       @request.contacts << contact = Contact.new(params[:contact]       if @request.save         # everything's fine       else         flash[:error] = @request.errors.full_messages.join(', ') + contact.errors.full_messages.join(', ')       end

No hope Again it shows

contacts is invalid   rather than the actual message what I expected

Sijo