From 713e28b753321cc8ed9fccf39ef756951382e87f Mon Sep 17 00:00:00 2001 From: Ken Johnson Date: Sun, 28 Apr 2013 02:58:24 -0400 Subject: [PATCH] might have added a subtle bug ;-) --- app/models/user.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 24b8860..1055b26 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,13 @@ class User < ActiveRecord::Base attr_accessible :email, :password, :user_id, :admin, :password_confirmation, :first_name, :last_name validates_confirmation_of :password, :password_confirmation - validates_presence_of :password, :on => :create + validates :password, :presence => true, + :confirmation => true, + :length => {:within => 6..40} + # I think this makes sense, have both, right? If we are updating our password and creating one? + :on => :create, + :on => :update + # Solution? Remove both :on => statements, it will naturally take effect for any changes. validates_presence_of :email validates_uniqueness_of :email validates_format_of :email, :with => /.+@.+\..+/i