mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
1 changed files with 1 additions and 5 deletions
|
@ -86,11 +86,7 @@ module ActiveModel
|
||||||
# p.errors[:name] # => ["can not be nil"]
|
# p.errors[:name] # => ["can not be nil"]
|
||||||
# p.errors['name'] # => ["can not be nil"]
|
# p.errors['name'] # => ["can not be nil"]
|
||||||
def [](attribute)
|
def [](attribute)
|
||||||
if errors = get(attribute.to_sym)
|
get(attribute.to_sym) || set(attribute.to_sym, [])
|
||||||
errors
|
|
||||||
else
|
|
||||||
set(attribute.to_sym, [])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds to the supplied attribute the supplied error message.
|
# Adds to the supplied attribute the supplied error message.
|
||||||
|
|
Loading…
Reference in a new issue