Open picart opened 10 years ago
@picart This is the step where you need to add validations to the Post model. (We need some way to know when we have “invalid attributes”). Once you have validations in place, your controller can have a conditional something like this:
if @post.save go to post page else go to new post form end
The Ruby on Rails guide for validations is pretty good: http://guides.rubyonrails.org/active_record_validations.html
Also, section 3.4.5 in the Rails 4 in Action book has some guidance as well.
I got this error in creating posts spec and found similar but slightly different code in the book (pictured above). Without solving this issue I passed to the next scenario.
Now I have a similar error in viewing posts spec and anticipate I will do this at least twice more so I thought I'd submit an issue and get some feedback please.