aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 1889a3bf0..6c14b93fb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -11,11 +11,11 @@ class User < ActiveRecord::Base
belongs_to :organisation
accepts_nested_attributes_for :organisation
-
- validates_presence_of :email
- validates_presence_of :name
- validates_presence_of :password
- validates_presence_of :password_confirmation
+
+ validates :organisation, :presence => true
+ validates :email, :presence => true, :uniqueness => true
+ validates :name, :presence => true
+ validates :password, :presence => true, :confirmation => true
before_validation(:on => :create) do
self.password ||= Devise.friendly_token.first(6)