aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-02-20 23:53:36 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-02-20 23:53:36 +0900
commit66e2e19bc03d4dc5f775848ceedb33ada75a7ace (patch)
treed2c6abc194e4fbbc03cf1b8ca023f18e681bbe5b /activemodel
parent9a476b8cd6724699027eb00ec7ffa8b232d1b734 (diff)
downloadrails-66e2e19bc03d4dc5f775848ceedb33ada75a7ace.tar.gz
rails-66e2e19bc03d4dc5f775848ceedb33ada75a7ace.tar.bz2
rails-66e2e19bc03d4dc5f775848ceedb33ada75a7ace.zip
use `messages` instead of deprecated `ActiveModel::Errors#[]=` method [ci skip]
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/README.rdoc2
-rw-r--r--activemodel/lib/active_model/validator.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc
index f6beff14e1..0985f56bfb 100644
--- a/activemodel/README.rdoc
+++ b/activemodel/README.rdoc
@@ -219,7 +219,7 @@ behavior out of the box:
class HasNameValidator < ActiveModel::Validator
def validate(record)
- record.errors[:name] = "must exist" if record.name.blank?
+ record.errors.messages[:name] << "must exist" if record.name.blank?
end
end
diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb
index b98585912e..5752771d8c 100644
--- a/activemodel/lib/active_model/validator.rb
+++ b/activemodel/lib/active_model/validator.rb
@@ -15,7 +15,7 @@ module ActiveModel
# class MyValidator < ActiveModel::Validator
# def validate(record)
# if some_complex_logic
- # record.errors[:base] = "This record is invalid"
+ # record.errors.messages[:base] << "This record is invalid"
# end
# end
#