Bulk change of configuration via CLI in multiple user profiles/preferences

Thank you very much @simon - that code helped me a lot.

I have absolutely ZERO experience with Ruby but I do have experience with other languages so it didn’t take me too long to come with the following code:

all_users = User.find_each()

all_users.each do |user|
    if user.id > 70 and user.active == true and user.admin == false and user.trust_level == 1 and user.suspended_at == nil and user.moderator == false
        puts "MODIFY: #{user.id}: #{user.trust_level}: \"#{user.username}\""
        user.update(locale: :fr)
    else
        # skip this user
        puts "------: #{user.id}: #{user.trust_level}: \"#{user.username}\""
    end
end

I know nothing about Ruby so there is probably a clever way how to do it. But this works for me :wink: . Thank you.

5 Likes