Forum: Ruby on Rails Virtual Atrributes + error_message_for ploblem?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
56b63ca3f149742bc54e54c8f07cc9c7?d=identicon&s=25 David Sousa (mrsousa)
on 2009-01-13 02:06
Hello there,

I used a screencast ( http://railscasts.com/episodes/16 ) to make a
Nested form.
The problem is that when I will show the error_messages_for I will just
get a single line of error for each element that is related with the
main element.

Codes are here:

http://pastie.org/359215 - Invoice.rb
http://pastie.org/359217 - InvoiceItem.rb
http://pastie.org/359218 - Controller.rb

Error looks like this:

6 errors prohibited this Invoice from being saved
There were problems with the following fields:
    * Invoice item is invalid
    * Invoice item is invalid
    * Invoice item is invalid
    * Invoice item is invalid
    * Invoice item is invalid
    * Invoice item is invalid

What I was expecting to receive was some thing like:

6 errors prohibited this Invoice from being saved
There were problems with the following fields:
    * Invoice item name can't be black
    * Invoice item price can't be black
    * Invoice item name is too short
    * Invoice item name can't be black
    * Invoice item name is too long
    * Invoice item price can't be black


Anyone has an idea how to fix it?

Tks,

David Sousa
56b63ca3f149742bc54e54c8f07cc9c7?d=identicon&s=25 David Sousa (mrsousa)
on 2009-01-14 03:23
Uhm.... anyone?
The problem is not solved yet!

tks,

David Sousa
This topic is locked and can not be replied to.