summaryrefslogtreecommitdiff
path: root/users/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-26 10:59:50 +0100
committerAzul <azul@leap.se>2012-11-26 10:59:50 +0100
commitce0999ead0d61db1f6534ee9d8114c4551542e80 (patch)
tree40600388d20ecda99a23ec89c15ee715450ff824 /users/app/models
parent76a3b91ad78d12ef82a0c01ca702720a510f1e22 (diff)
minor: client side validations fixed + .json request
Diffstat (limited to 'users/app/models')
-rw-r--r--users/app/models/user.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index 624754b..39d079a 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -9,7 +9,8 @@ class User < CouchRest::Model::Base
:presence => true
validates :login,
- :uniqueness => true
+ :uniqueness => true,
+ :if => :serverside?
validates :login,
:format => { :with => /\A[A-Za-z\d_]+\z/,
@@ -74,4 +75,9 @@ class User < CouchRest::Model::Base
def password
password_verifier
end
+
+ # used as a condition for validations that are server side only
+ def serverside?
+ true
+ end
end