diff options
| author | Michel Etienne | 2014-11-13 17:05:49 +0100 |
|---|---|---|
| committer | Michel Etienne | 2014-11-13 17:05:49 +0100 |
| commit | ab46893445585fcd2ebee469c8c2065cecd5963d (patch) | |
| tree | d414b0c0a5865501b6dc57d94f20f1305435463d /app/models | |
| parent | 0350755d84ca7c19398799f48914cd1ae2ede23d (diff) | |
| parent | fbd4c5a9de723136d78c1e8cd37598fc465f1be4 (diff) | |
| download | chouette-core-ab46893445585fcd2ebee469c8c2065cecd5963d.tar.bz2 | |
Merge branch 'sismo' into gtfs_v2
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/organisation.rb | 3 | ||||
| -rw-r--r-- | app/models/user.rb | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 17cf9a8f2..f4b2e35f8 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -3,6 +3,5 @@ class Organisation < ActiveRecord::Base has_many :users, :dependent => :destroy has_many :referentials, :dependent => :destroy - validates_presence_of :name - validates_uniqueness_of :name + validates :name, :presence => true, :uniqueness => true end 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) |
