hi everyone here i go again, i have problem we error message validation
here is the sample of my code:
error_messages_for :user, :header_message => ‘X errors, please find red
mark’, :message => ‘Following errors were found:’
the problem is that how where going to get the value “X errors” or the
number of errors if they have when the is submitted.
I like the idea of the default error message that have a counter of
errors like for example “2 errors prohibited this user from being
saved”. My purpose is to make my own error message but the idea of
displaying the number of errors is my problem. Please help me on how to
do it. Thank you in advance…
Need your help RoR masters…
i need a solution my friend. any help or advice would be appreciated.
Thank you
Haven’t tried this, but how about
“#{User.errors.size} errors, please …”
On Feb 5, 10:33 pm, Johnroy W. [email protected]
alberto wrote:
On Feb 5, 1:26�am, Johnroy W. [email protected]
wrote:
error_messages_for :user, :header_message => ‘X errors, please find red
mark’, :message => ‘Following errors were found:’
@user.errors.full_messages
that will return an array of the text messages. So you can do
@user.errors.full_messages.size and then iterate on them to create
your own error message.
nice one know i know, thanks a lot, your the man… keep up the good work
On Feb 5, 1:26 am, Johnroy W. [email protected]
wrote:
error_messages_for :user, :header_message => ‘X errors, please find red
mark’, :message => ‘Following errors were found:’
@user.errors.full_messages
that will return an array of the text messages. So you can do
@user.errors.full_messages.size and then iterate on them to create
your own error message.