demarches-normaliennes/lib/tasks/2018_08_24_encrypt_tokens.rake

11 lines
248 B
Ruby
Raw Normal View History

2018-08-24 16:47:18 +02:00
namespace :'2018_08_24_encrypt_tokens' do
task run: :environment do
Administrateur
.where
.not(api_token: nil)
.each do |admin|
admin.update(encrypted_token: BCrypt::Password.create(admin.api_token))
end
end
end