# Approving a new user with ruby console

**URL:** https://meta.discourse.org/t/approving-a-new-user-with-ruby-console/143478
**Category:** Development
**Created:** [March 6, 2020, 6:09am UTC](https://meta.discourse.org/t/approving-a-new-user-with-ruby-console/143478 "2020-03-06T06:09:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![csmu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/csmu/32/124581_2.png) [@csmu](https://meta.discourse.org/u/csmu)
#### Post date: [March 6, 2020, 6:09am UTC](https://meta.discourse.org/t/approving-a-new-user-with-ruby-console/143478/1 "2020-03-06T06:09:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [March 6, 2020, 6:21am UTC](https://meta.discourse.org/t/approving-a-new-user-with-ruby-console/143478/2 "2020-03-06T06:21:07Z")

</div>

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

```plaintext
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/main/app/controllers/admin/users_controller.rb#L275-L283>

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [March 29, 2020, 9:37pm UTC](https://meta.discourse.org/t/approving-a-new-user-with-ruby-console/143478/3 "2020-03-29T21:37:09Z")

</div>


