From 929699602978a2d3c6abc953ebe592a58baf3bff Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 7 Feb 2012 20:29:02 -0200 Subject: Fixes in AMo README --- activemodel/README.rdoc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'activemodel/README.rdoc') diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc index 9208145507..139dfa0c1a 100644 --- a/activemodel/README.rdoc +++ b/activemodel/README.rdoc @@ -87,10 +87,9 @@ modules: errors.add(:name, "can not be nil") if name.nil? end - def ErrorsPerson.human_attribute_name(attr, options = {}) + def self.human_attribute_name(attr, options = {}) "Name" end - end person.errors.full_messages @@ -163,7 +162,7 @@ modules: * Custom validators - class Person + class ValidatorPerson include ActiveModel::Validations validates_with HasNameValidator attr_accessor :name @@ -171,7 +170,7 @@ modules: class HasNameValidator < ActiveModel::Validator def validate(record) - record.errors[:name] = "must exist" if record.name.blank? + record.errors[:name] = "must exist" if record.name.blank? end end @@ -182,7 +181,7 @@ modules: p.valid? # => true {Learn more}[link:classes/ActiveModel/Validator.html] - + == Download and installation -- cgit v1.2.3