app/models/effective/csv_importer.rb in effective_developer-0.4.11 vs app/models/effective/csv_importer.rb in effective_developer-0.4.12
- old
+ new
@@ -127,12 +127,14 @@
end
def assign_valid_email(user, at: 'example.com')
raise 'expected an object that responds to email=' unless user.respond_to?('email=')
+ # Normalize email
user.email = user.email.to_s.strip.downcase.gsub(' ', '').presence
- user.email = user.email.split(' or ').first if user.email.include?(' or ')
+ user.email = nil unless user.email.to_s.count('@') == 1
+ # Assign if empty
if user.email.blank?
if user.respond_to?(:first_name) && user.respond_to?(:last_name)
user.email ||= [user.first_name.to_s.parameterize.presence, user.last_name.to_s.parameterize.presence].compact.join('.').presence
end