Rather than loading the groups and then iterating through and getting the id, I think `pluck` would be more suitable here:

    user.forem_groups.pluck(:id)