mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
It should be ActiveModel::Validator, not ActiveRecord::Validator.
This commit is contained in:
parent
73dafba6ca
commit
de4f9acad8
1 changed files with 1 additions and 1 deletions
|
@ -414,7 +414,7 @@ class Person < ActiveRecord::Base
|
||||||
validates_with GoodnessValidator
|
validates_with GoodnessValidator
|
||||||
end
|
end
|
||||||
|
|
||||||
class GoodnessValidator < ActiveRecord::Validator
|
class GoodnessValidator < ActiveModel::Validator
|
||||||
def validate
|
def validate
|
||||||
if record.first_name == "Evil"
|
if record.first_name == "Evil"
|
||||||
record.errors[:base] << "This person is evil"
|
record.errors[:base] << "This person is evil"
|
||||||
|
|
Loading…
Reference in a new issue