lib/validators/phony_validator.rb in phony_rails-0.1.4 vs lib/validators/phony_validator.rb in phony_rails-0.1.5
- old
+ new
@@ -7,6 +7,18 @@
def validate_each(record, attribute, value)
return if value.blank?
record.errors[attribute] << (options[:message] || "is an invalid number") if not Phony.plausible?(value)
end
-end
\ No newline at end of file
+end
+
+module ActiveModel
+ module Validations
+ module HelperMethods
+
+ def validates_plausible_phone(*attr_names)
+ validates_with PhonyPlausibleValidator, _merge_attributes(attr_names)
+ end
+
+ end
+ end
+end