Error reporting problem

Forums > Book - Chapter 4 > Error reporting problem

Login to post a new topic

Author Message
tmkouba
Member since 05 Feb 16:30
0 posts

Has anyone else had any problems displaying categories and articles errors? For example, I click on the link to create a new article, don’t enter any data and push the save button. I expect to receive an error message saying that it didn’t create my new article because there was no title, synopsis or body. But I don’t receive any errors; it just silently doesn’t create the new record.
app/models/article.rb has the following code:
validates_presence_of :title
validates_presence_of :synopsis
validates_presence_of :body
and my modified version of app/views/articles/new.rhtml has
<%= error_messages_for :article %>
But I don’t see the error message saying that it didn’t create my new article because there was no title, synopsis or body. It just silently doesn’t create the new record.
The error messages display as expected when creating new pages (chapter 2) but not for categories & articles in chapter 4.
Has anyone else encountered this? Do error messages display when you create a blank article?

paulg
Member since 06 Mar 08:57
0 posts

I was having the same problem and then I noticed in the routes.rb file I moved the map.resources statements above the map.connect statements and that seemed to make the adding categories and adding articles work. great!