Approving a new user with ruby console

When I create a new user and activate the user in ruby console I end up with a request for approval in the Graphical user Interface (GUI).

How do you approve a new user in ruby console?

Without running this, I think this is what you would want:

ReviewableUser.find_by(target: target_user).perform(your_user, :approve_user)

This comes from the approve route on the UsersController.

https://github.com/discourse/discourse/blob/master/app/controllers/admin/users_controller.rb#L275-L283

9 Likes