lib/validates-email.rb in validates-email-0.0.1 vs lib/validates-email.rb in validates-email-0.0.2
- old
+ new
@@ -1,22 +1,4 @@
-module ValidatesEmail
+require 'active_record'
-
+module ValidatesEmail
end
-
-module ActiveRecord
- module Validations
- class EmailValidator < ActiveModel::EachValidator
- def validate_each(record, attribute, value)
- record.errors[attribute] << (options[:message] || 'is invalid') unless value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
- end
- end
-
- module ClassMethods
- def validates_email(*attr_names)
- validates_with EmailValidator, _merge_attributes(attr_names)
- end
- end
-
- end
-end
-
\ No newline at end of file