diff options
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/README.rdoc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc index 6f737d0d8b..a7ba27ba73 100644 --- a/activemodel/README.rdoc +++ b/activemodel/README.rdoc @@ -89,10 +89,9 @@ behavior out of the box: 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 @@ -165,7 +164,7 @@ behavior out of the box: * Custom validators - class Person + class ValidatorPerson include ActiveModel::Validations validates_with HasNameValidator attr_accessor :name @@ -173,7 +172,7 @@ behavior out of the box: 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 |