mercredi 4 mars 2015

Rails: expect valid? to return false, but always got true

I am studying Michael Hartl's Ruby on Rails Tutorial, and is stuck in validating. Here is my testing in console:


root@sample_app# rails console Loading development environment (Rails 4.2.0)




user = User.new(name: "", email: "mhartl@example.com") => # user.valid? => true


user = User.new(name: "Example User", email: "mhartl@example.com") => # user.valid? => true




No matter what the name is, user.valid? always return true. Anybody know why? Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire