Hi everyone,

I am a total novice with Ruby on Rails and I'm having a problem using validates_presence_of. I'm following a tutorial from a book called "Ruby on rails: up and running" and I'm not getting the result I expect (and what the book expects).

Here's my model: class Photo < ActiveRecord::Base   validates_presence_of :filename end

I tested this using rails console:

=> #<Photo id: nil, filename: nil>

=> true

puts photo.filename


I expect (and so does the book) that returns false and nothing is saved to the database, but it saves anyway. Any ideas what I am doing wrong? Forgive me if it's something ridiculously simple that I've overlooked, it is quite late :wink: If you could point me in the right direction I would be greatly appreciative.

Cheers, Adam