Bulk edit users - remove moderator privilege

After running an import seems that the script has given moderator privileges to half of the users.

I didn’t get a chance to see what DB structure looks like, so if someone would kindly help me adapt this

User.where(“is_moderator”).update_all(is_moderator: false)

Thanks

That’s pretty close… Maybe this is it?

 User.where(moderator: true).update_all(moderator: false)

You can do something like

 User.last

To see the properties.

2 Likes

Thanks, it did the trick :slight_smile:

For anyone needing this, here is the full procedure.

./launcher enter app
# rails c
# User.where(moderator: true).update_all(moderator: false)
2 Likes