Updated user validation. Fixed duplicates on 'nick'.

This commit is contained in:
Benjamin Meichsner 2010-02-16 09:53:24 +01:00
parent 1b9ae83496
commit b9576dd669

View file

@ -35,9 +35,9 @@ class User < ActiveRecord::Base
validates_presence_of :nick, :email validates_presence_of :nick, :email
validates_presence_of :password_hash, :message => "Password is required." validates_presence_of :password_hash, :message => "Password is required."
validates_length_of :nick, :in => 2..25 validates_length_of :nick, :in => 2..25
validates_uniqueness_of :nick validates_uniqueness_of :nick, :case_sensitive => false
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
validates_uniqueness_of :email validates_uniqueness_of :email, :case_sensitive => false
validates_length_of :first_name, :in => 2..50 validates_length_of :first_name, :in => 2..50
validates_confirmation_of :password validates_confirmation_of :password
validates_length_of :password, :in => 5..25, :allow_blank => true validates_length_of :password, :in => 5..25, :allow_blank => true