diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-19 23:03:32 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-19 23:03:32 -0200 |
commit | 05b80a1cce490b200cefd9d5363d20d55e8eb031 (patch) | |
tree | a14dfb3b45bb56078e88196bbebd7e053079129f /activemodel | |
parent | dd4822ce163f273407eb3493e08c8543e479bf71 (diff) | |
download | rails-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')
-rw-r--r-- | activemodel/CHANGELOG.md | 12 |
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. |