Skip to content
Browse files

Fixes in AMo README

  • Loading branch information...
1 parent e3e7e05 commit 929699602978a2d3c6abc953ebe592a58baf3bff @carlosantoniodasilva carlosantoniodasilva committed Feb 7, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 activemodel/README.rdoc
View
9 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,15 +162,15 @@ modules:
* Custom validators
- class Person
+ class ValidatorPerson
include ActiveModel::Validations
validates_with HasNameValidator
attr_accessor :name
end
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

0 comments on commit 9296996

Please sign in to comment.
Something went wrong with that request. Please try again.