added user model

This commit is contained in:
Edin Dazdarevic
2015-02-20 06:55:18 +01:00
parent 7c27d9415a
commit 8f904099cf
6 changed files with 55 additions and 8 deletions

9
front-api/models/user.rb Normal file
View File

@@ -0,0 +1,9 @@
class User < ActiveRecord::Base
has_secure_password
validates_presence_of :first_name, :last_name, :password, :email, :password_confirmation
validates :email, :uniqueness => {:case_sensitive => false, :message => "Email already exists!"},
format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, message: "invalid email" }
validates :password, confirmation: true, length: { in:6..20, too_short: 'password needs to be at least 6 characters long' }
end