Displaying 1 result from an estimated 1 matches for "emailvalid".
Did you mean:
emailval
2012 Aug 05
0
ActiveRecord::Validator vs ActiveModel::Validator
...h is used for the class level validation macros.
But I didn''t find a an ActiveRecord Validator class.
From my understanding in Rails 3, validations have been moved into
ActiveModel to leave ActiveRecord as an ORM.
So now I see this Rails 3 code in a Rails 3 book and get confused:
Class EmailValidator < ActiveRecord::Validator
def validate()
email_field = options[:attr]
record.errors[email_field] << “is not valid” unless
record.send(email_field) =~ /^[a-z]$/
end
end
class Account < ActiveRecord::Base
validates_with EmailValidator, :attr => :email
end
Where is...