lib/validators/phony_validator.rb in phony_rails-0.1.7 vs lib/validators/phony_validator.rb in phony_rails-0.1.8
- old
+ new
@@ -4,10 +4,10 @@
class PhonyPlausibleValidator < ActiveModel::EachValidator
# Validates a String using Phony.plausible? method.
def validate_each(record, attribute, value)
return if value.blank?
- record.errors[attribute] << (options[:message] || "is an invalid number") if not Phony.plausible?(value)
+ record.errors.add(attribute, options[:message] || :improbable_phone) if not Phony.plausible?(value)
end
end
module ActiveModel