summaryrefslogtreecommitdiff
path: root/app/models/user.rb
blob: 37af2c65e26be8eb0c29fb218ecb03865965c098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
class User < ActiveRecord::Base
  attr_accessible :name, :email
  
  EmailRegex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates_presence_of :name, :email
  validates_length_of   :name, :maximum => 50
  validates_format_of   :email, :with => EmailRegex
  
  validates_format_of     :email, :with => EmailRegex
  validates_uniqueness_of :email, :case_sensitive => false
end