Tidy up error.rb code
[#5288 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
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.
|
||||
|
Loading…
Reference in New Issue
Block a user