I’m looking for some example ruby code to set a primary group for a user.
Snippet
candidate['groups'].each do |group|
if group.user_ids.include?(user.id) then
# already a member
else
group.add user
if user.primary_group == nil then
user.primary_group = group
user.save
end
end
end
2 Likes