Skip to content

Commit

Permalink
Tidy up error.rb code
Browse files Browse the repository at this point in the history
[#5288 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information
subbarao authored and spastorino committed Aug 3, 2010
1 parent 677e1e5 commit 5987fd4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions activemodel/lib/active_model/errors.rb
Expand Up @@ -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.
Expand Down

0 comments on commit 5987fd4

Please sign in to comment.