abritium_app/lib/tasks/fourrure.rake
Nicolas Bally a92bd4db72 initial
2019-05-08 11:30:56 +02: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