demarches-normaliennes/app/models/concerns/email_sanitizable_concern.rb
2018-03-14 17:41:45 +01:00

10 lines
275 B
Ruby

module EmailSanitizableConcern
extend ActiveSupport::Concern
def sanitize_email(attribute)
value_to_sanitize = self.send(attribute)
if value_to_sanitize.present?
self[attribute] = value_to_sanitize.gsub(/[[:space:]]/, ' ').strip.downcase
end
end
end