Hi I would like to understand how are the error messages displayed in ruby on rails, more importantly how is the order determined in which the error messages are displayed on the page.
Thanks for your time.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Most common way to display errors is to use helper
error_messages:As far as I know it adds some html tags to error messages that are stored in
@my_object.errorshash. Error messages are ordered hash and they are in order that your validations are specified in model (at least it works like this in my applications). You can read more about Errors class here.Since
error_messagesare just a helper, you can write your own helper to display error messages.