Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if group and emails.any?
- emails.each do |email|
- if user = Spree::User.find_by(email: email)
- if user.user_group.present?
- if user.user_group != group
- puts "User #{user.email} is already in group #{user.user_group.name}"
- end
- else
- user.update_column(user_group_id: group.id)
- end
- else
- user = Spree::User.new(email: email)
- user.password = password
- user.skip_confirmation! if Spree::Auth::Config[:confirmable]
- user.save!
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement