aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/README.rdoc
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-20 20:57:56 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-20 20:58:58 -0200
commitf55bfe726045594c78438841cdccd5843522deab (patch)
tree30bb111448809e786724bf3397a2c72af3ad9fda /activemodel/README.rdoc
parent08d9c7532c7081d6b5964b8edf802fab72224cd7 (diff)
downloadrails-f55bfe726045594c78438841cdccd5843522deab.tar.gz
rails-f55bfe726045594c78438841cdccd5843522deab.tar.bz2
rails-f55bfe726045594c78438841cdccd5843522deab.zip
Change the deprecation messages to show the preferred way to work with
ActiveModel::Errors
Diffstat (limited to 'activemodel/README.rdoc')
-rw-r--r--activemodel/README.rdoc8
1 files changed, 4 insertions, 4 deletions
diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc
index 0985f56bfb..4920666f27 100644
--- a/activemodel/README.rdoc
+++ b/activemodel/README.rdoc
@@ -49,7 +49,7 @@ behavior out of the box:
send("#{attr}=", nil)
end
end
-
+
person = Person.new
person.clear_name
person.clear_age
@@ -132,7 +132,7 @@ behavior out of the box:
"Name"
end
end
-
+
person = Person.new
person.name = nil
person.validate!
@@ -216,10 +216,10 @@ behavior out of the box:
{Learn more}[link:classes/ActiveModel/Validations.html]
* Custom validators
-
+
class HasNameValidator < ActiveModel::Validator
def validate(record)
- record.errors.messages[:name] << "must exist" if record.name.blank?
+ record.errors.add(:name, "must exist") if record.name.blank?
end
end