diff options
author | Azul <azul@leap.se> | 2012-12-10 11:00:24 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-12-10 11:00:24 +0100 |
commit | 28b21959f39b0e28c450bba54b8696632a0187fa (patch) | |
tree | 7f13cad03190324ca0d242d3aee74bfb4efb00fa /users/app/models | |
parent | e4c7f2fb8fa2833037508f1b88f802944855fd77 (diff) |
created generic Email class and use it with EmailAliases
Diffstat (limited to 'users/app/models')
-rw-r--r-- | users/app/models/email.rb (renamed from users/app/models/email_alias.rb) | 7 | ||||
-rw-r--r-- | users/app/models/user.rb | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/users/app/models/email_alias.rb b/users/app/models/email.rb index 25e4b27..0988d9f 100644 --- a/users/app/models/email_alias.rb +++ b/users/app/models/email.rb @@ -1,6 +1,9 @@ -class EmailAlias +class Email include CouchRest::Model::Embeddable property :email, String - timestamps! + + def to_s + email + end end diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 3ad69c7..fcb211e 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -6,7 +6,7 @@ class User < CouchRest::Model::Base property :email, String, :accessible => true property :email_forward, String, :accessible => true - property :email_aliases, [EmailAlias] + property :email_aliases, [Email] validates :login, :password_salt, :password_verifier, :presence => true @@ -77,7 +77,7 @@ class User < CouchRest::Model::Base def email_aliases_attributes=(attrs) if attrs - email_alias = EmailAlias.new(attrs.values.first) + email_alias = Email.new(attrs.values.first) email_aliases << email_alias end end |