diff options
author | Azul <azul@leap.se> | 2014-07-09 12:51:16 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2014-07-09 12:51:16 +0200 |
commit | 0cc11ebb609de225fbeacbf80788b992b88b6ce6 (patch) | |
tree | 3dbf8562e91ac7d7c8759a0516efbdca93cbdeff /app/models | |
parent | bdb4b0e275c205b0b44bbe3cc4ec4c162b309b37 (diff) |
list identities based on search only
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/identity.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb index e09d7f2..eb67b1b 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -46,6 +46,10 @@ class Identity < CouchRest::Model::Base end + def self.address_starts_with(query) + self.by_address.startkey(query).endkey(query + "\ufff0") + end + def self.for(user, attributes = {}) find_for(user, attributes) || build_for(user, attributes) end diff --git a/app/models/user.rb b/app/models/user.rb index f8b9ddc..6bc5841 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -42,6 +42,10 @@ class User < CouchRest::Model::Base view :by_created_at end # end of design + def self.login_starts_with(query) + self.by_login.startkey(query).endkey(query + "\ufff0") + end + def reload @identity = nil super |