how do i display error messages in the web browser when using rails?
eg. if i use a variable in the view that i hasn’t defined in the controller i want to get an error message.
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.
In your controller:
In your view:
The documentation for the Flash hash is available here.
To rescue from errors at the application level rather than displaying error messages to the user, you can use
Examples:
Customising the generic Rails error message
http://www.perfectline.co.uk/blog/custom-dynamic-error-pages-in-ruby-on-rails