creddit/app/models/user.rb
2015-07-09 16:31:41 -04:00

15 lines
321 B
Ruby

class User < ActiveRecord::Base
has_secure_password
before_save :downcase_email
validates :email, presence: true, uniqueness: true
validates :username, presence: true, uniqueness: true
validates :password, length: { minimum: 8 }
private
def downcase_email
self.email = self.email.downcase
end
end