5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/models/gemgento/adapter/sellect/customer.rb', line 5
def self.import
self.table_name = 'sellect_users'
stores = Gemgento::Store.all
self.all.each do |sellect_user|
user = Gemgento::User.find_or_initialize_by(email: sellect_user.email)
user.email = sellect_user.email
user.first_name = sellect_user.first_name
user.last_name = sellect_user.last_name
user.dob = sellect_user.bday
user.encrypted_password = sellect_user.encrypted_password
user.magento_password = (0...8).map { (65 + rand(26)).chr }.join
user.sign_in_count = sellect_user.sign_in_count
user.current_sign_in_at = sellect_user.current_sign_in_at
user.last_sign_in_at = sellect_user.last_sign_in_at
user.current_sign_in_ip = sellect_user.current_sign_in_ip
user.last_sign_in_ip = sellect_user.last_sign_in_ip
user.user_group = Gemgento::UserGroup.find_by(code: 'General')
user.sync_needed = false
user.save(validate: false)
user.stores = stores
user.sync_needed = true
user.save(validate: false)
end
end
|