Including a Module within a model


#1

If I have a module with a callback in it:

module Sanitize
module PhoneNumber
def before_validation
self.phone.gsub!(/\D/, ‘’) if attribute_present?(‘phone’)
end
end

module MobileNumber
def before_validation
self.mobile.gsub!(/\D/, ‘’) if attribute_present?(‘mobile’)
end
end
end

and then I include that within my model:

class Contact < ActiveRecord::Base
include Sanitize::PhoneNumber
end

Why doesn’t it work?? Any ideas?