Orbit/lib/tasks/member_user_id.rake

34 lines
407 B
Ruby
Raw Normal View History

# encoding: utf-8
namespace :member_user_id do
task :member_user_id_copy => :environment do
puts 'start'
@users = User.all
@users.each do |user|
if user.user_id.blank?
@ids = []
@ids = user.email.split("@")
user.user_id = @ids[0]
user.save
else
puts 'no data'
end
end
puts 'end'
puts @users.count
end
end