creddit/app/models/user.rb

16 lines
321 B
Ruby
Raw Normal View History

2015-07-08 15:17:37 -04:00
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