Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. company_users_data = {
  2. 387770 => 220080,
  3. 251270 => 280,
  4. 234938 => 280,
  5. 514522 => 221609,
  6. 32472 => 24721,
  7. 750763 => 24721,
  8. 7688 => 5365,
  9. 33107 => 25236,
  10. 130705 => 84267,
  11. 665658 => 236293,
  12. 699926 => 249630,
  13. 383330 => 216379,
  14. 102936 => 75667,
  15. 716451 => 227720,
  16. 492492 => 227720,
  17. 141311 => 103129,
  18. 220785 => 49377,
  19. 125092 => 2928,
  20. 22624 => 2928,
  21. 688020 => 2928,
  22. 208720 => 2928,
  23. 73469 => 2928,
  24. 159969 => 2928,
  25. 193718 => 2928,
  26. 374975 => 2928,
  27. 72648 => 2928,
  28. 128467 => 2928
  29. }
  30.  
  31. setting = Setting.find_or_create_by(name: 'pipeline_view_settings')
  32.  
  33. company_users_data.each do |company_user_id, company_id|
  34. company_user = CompanyUser.find_by(company_id: company_id, id: company_user_id)
  35. user_setting = company_user.settings['pipeline_view_settings'] || {}
  36.  
  37. CompanyUserSetting.create(
  38. company_id: company_id,
  39. company_user_id: company_user_id,
  40. setting_id: setting.id,
  41. setting_value: user_setting.to_json
  42. )
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement