No need for exception for setting

This commit is contained in:
Martin Lensment 2014-09-02 15:51:51 +03:00
parent 710ac1db92
commit 59d318b953

View file

@ -33,13 +33,8 @@ module EppErrors
next unless code = find_epp_code(err) next unless code = find_epp_code(err)
err = { code: code, msg: err } err = { code: code, msg: err }
# If we have setting relation, then still add the value to the error message # if the key represents relations, skip value
# If this sort of exception happens again, some other logic has to be implemented unless self.class.reflect_on_association(key)
if self.class.reflect_on_association(key) && key == :setting
err[:value] = { val: send(key).value, obj: self.class::EPP_ATTR_MAP[key] }
# if the key represents other relations, skip value
elsif !self.class.reflect_on_association(key)
err[:value] = { val: send(key), obj: self.class::EPP_ATTR_MAP[key] } err[:value] = { val: send(key), obj: self.class::EPP_ATTR_MAP[key] }
end end