From 8d9d8bc93cd603d76c39779a55142715d8153e88 Mon Sep 17 00:00:00 2001 From: Subba Rao Pasupuleti Date: Tue, 3 Aug 2010 12:35:58 -0400 Subject: Tidy up error.rb code [#5288 state:committed] Signed-off-by: Santiago Pastorino --- activemodel/lib/active_model/errors.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index f39678db83..05e353ce18 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -86,11 +86,7 @@ module ActiveModel # 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. -- cgit v1.2.3