aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorSubba Rao Pasupuleti <subbarao.pasupuleti@gmail.com>2010-08-03 12:35:58 -0400
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-03 14:54:13 -0300
commit8d9d8bc93cd603d76c39779a55142715d8153e88 (patch)
treecbe9669830deca8b92f3c09ce3709db3eab04111 /activemodel
parent41c1aa607dc9633c05e7946b7d2cf6f5c6954317 (diff)
downloadrails-8d9d8bc93cd603d76c39779a55142715d8153e88.tar.gz
rails-8d9d8bc93cd603d76c39779a55142715d8153e88.tar.bz2
rails-8d9d8bc93cd603d76c39779a55142715d8153e88.zip
Tidy up error.rb code
[#5288 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/errors.rb6
1 files changed, 1 insertions, 5 deletions
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.