Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. if group and emails.any?
  2. emails.each do |email|
  3. if user = Spree::User.find_by(email: email)
  4. if user.user_group.present?
  5. if user.user_group != group
  6. puts "User #{user.email} is already in group #{user.user_group.name}"
  7. end
  8. else
  9. user.update_column(user_group_id: group.id)
  10. end
  11. else
  12. user = Spree::User.new(email: email)
  13. user.password = password
  14. user.skip_confirmation! if Spree::Auth::Config[:confirmable]
  15. user.save!
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement