From 05b80a1cce490b200cefd9d5363d20d55e8eb031 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Wed, 19 Dec 2012 23:03:32 -0200 Subject: [PATCH] Improve AMo changelog example to not rely on AR [ci skip] --- activemodel/CHANGELOG.md | 12 ++++++++---- 1 file 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.