Tidy up error.rb code

[#5288 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
Subba Rao Pasupuleti 2010-08-03 12:35:58 -04:00 committed by Santiago Pastorino
parent 41c1aa607d
commit 8d9d8bc93c

@ -86,11 +86,7 @@ def initialize(base)
# p.errors[:name] # => ["can not be nil"]
# p.errors['name'] # => ["can not be nil"]
def [](attribute)
if errors = get(attribute.to_sym)
errors
else
set(attribute.to_sym, [])
end
get(attribute.to_sym) || set(attribute.to_sym, [])
end
# Adds to the supplied attribute the supplied error message.