diff options
author | Azul <azul@leap.se> | 2014-05-29 10:04:07 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2014-05-29 10:04:07 +0200 |
commit | e0d31118d6e4110d2c280afa9415cfe9def29deb (patch) | |
tree | ffa589ee7df174d0eaa20cec254a7251f425f402 /app/models/identity.rb | |
parent | 016e61ce9ab44cf58355e843b0c0d0085d373fc7 (diff) |
hand on errors from Email to Identity to User
errors.each iterates through all errors for all attrbibutes nicely.
Diffstat (limited to 'app/models/identity.rb')
-rw-r--r-- | app/models/identity.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb index 25be971..f2727c8 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -141,15 +141,17 @@ class Identity < CouchRest::Model::Base def address_local_email return if address.valid? #this ensures it is a valid local email address - # we only hand on the first error for now. - self.errors.add(:address, address.errors.messages.values.first) + address.errors.each do |attribute, error| + self.errors.add(:address, error) + end end def destination_email return if destination.nil? # this identity is disabled return if destination.valid? # this ensures it is Email - # we only hand on the first error for now. - self.errors.add(:destination, destination.errors.messages.values.first) + destination.errors.each do |attribute, error| + self.errors.add(:destination, error) + end end end |