coton_app/lib/tasks/fourrure.rake
2018-12-15 14:06:53 +01:00

21 lines
477 B
Ruby

namespace :fourrure do
desc "TODO"
task import: :environment do
@file = File.open(Rails.root.join('import_csv/fourrure_clean_mail.csv')).read
r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)
@emails = @file.scan(r).uniq
@emails.each do |mail|
fs = FourrureSender.new(:email => mail, :cgv => true, :name => "NA", :firstname => "NA", :imported => true)
fs.save
puts mail
end
end
end