To show a helpful error message in rails simply put
<%= error_messages_for( :class = ‘action’) %> in the view that you want the error message to show. Now this will work when you have some validation code in your model related to the view. For example “validates_presence_of :title :artist”. So when a user forgets to enter in the required fields they will be notified which fields they left out.
March 18, 2009, 11:06am Comments

