aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-19 23:03:32 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-19 23:03:32 -0200
commit05b80a1cce490b200cefd9d5363d20d55e8eb031 (patch)
treea14dfb3b45bb56078e88196bbebd7e053079129f /activemodel/CHANGELOG.md
parentdd4822ce163f273407eb3493e08c8543e479bf71 (diff)
downloadrails-05b80a1cce490b200cefd9d5363d20d55e8eb031.tar.gz
rails-05b80a1cce490b200cefd9d5363d20d55e8eb031.tar.bz2
rails-05b80a1cce490b200cefd9d5363d20d55e8eb031.zip
Improve AMo changelog example to not rely on AR [ci skip]
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 014500fa28..242915c833 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -2,17 +2,21 @@
* Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the
absence of attributes.
- class Person < ActiveRecord::Base
+ class Person
+ include ActiveModel::Validations
+
+ attr_accessor :first_name
validates_absence_of :first_name
end
person = Person.new
person.first_name = "John"
person.valid?
- => false
- # first_name must be blank
+ # => false
+ person.errors.messages
+ # => {:first_name=>["must be blank"]}
- * Roberto Vasquez Angel*
+ *Roberto Vasquez Angel*
* Added `ActiveModel::Errors#add_on_present` method. Adds error messages to
present attributes.