Permalink
Browse files

Tidy up error.rb code

[#5288 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 41c1aa6 commit 8d9d8bc93cd603d76c39779a55142715d8153e88 @subbarao subbarao committed with spastorino Aug 3, 2010
Showing with 1 addition and 5 deletions.
  1. +1 −5 activemodel/lib/active_model/errors.rb
@@ -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.

0 comments on commit 8d9d8bc

Please sign in to comment.