11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/ssn/active_record_extensions.rb', line 11
def has_ssn( *args )
options = args.
unless included_modules.include? InstanceMethods
self.class_eval { extend ClassMethods }
include InstanceMethods
validates_length_of :"raw_#{args.first.to_sym}", :maximum => 9, :allow_blank => true
validates_format_of :"raw_#{args.first.to_sym}", :with => Ssn::SocialSecurityNumber::UNFORMATTED_REGEX, :allow_blank => true
validates_format_of args.first.to_sym, :with => Ssn::SocialSecurityNumber::FORMATTED_REGEX, :allow_blank => true
end
initialize_has_ssn_from_args args
end
|