Browse files

Improve AMo changelog example to not rely on AR [ci skip]

  • Loading branch information...
1 parent dd4822c commit 05b80a1cce490b200cefd9d5363d20d55e8eb031 @carlosantoniodasilva carlosantoniodasilva committed Dec 19, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 activemodel/CHANGELOG.md
View
12 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.

0 comments on commit 05b80a1

Please sign in to comment.