# Is it possible to bulk activate pending users with the rails console?

**URL:** https://meta.discourse.org/t/is-it-possible-to-bulk-activate-pending-users-with-the-rails-console/139787
**Category:** Support
**Created:** [26 januari 2020 om 18:43 UTC](https://meta.discourse.org/t/is-it-possible-to-bulk-activate-pending-users-with-the-rails-console/139787 "2020-01-26T18:43:00Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2020 om 19:19 UTC](https://meta.discourse.org/t/is-it-possible-to-bulk-activate-pending-users-with-the-rails-console/139787/2 "2020-01-26T19:19:16Z")

</div>

Probably, but I don’t think this is good practice because you might end up spamming out emails to unverified addresses.

```plaintext
myInactiveUsers = User.where(active: false)

myInactiveUsers.each do |myInactiveUser|
  myInactiveUser.active = true
  myInactiveUser.save!
end

```

The above script should work, but I’m not sure if there would be additional unintended side-effects (functionally), use at your own risk!

This is just [Active Record Basics — Ruby on Rails Guides](https://guides.rubyonrails.org/active_record_basics.html)

And knowing the basic objects that Discourse maintains, in this case the User model.

The models are here: [discourse/app/models at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/tree/master/app/models)

---

_[View the full topic](https://meta.discourse.org/t/is-it-possible-to-bulk-activate-pending-users-with-the-rails-console/139787)._
