# (Obsolete) Set category tracking level defaults historically

**URL:** <https://meta.discourse.org/t/obsolete-set-category-tracking-level-defaults-historically/53165>\
**Category:** Self-Hosting\
**Tags:** how-to\
**Created:** [2016年十一月21日 00:45 UTC](https://meta.discourse.org/t/obsolete-set-category-tracking-level-defaults-historically/53165 "2016-11-21T00:45:27Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2017年二月7日 15:30 UTC](https://meta.discourse.org/t/obsolete-set-category-tracking-level-defaults-historically/53165/28 "2017-02-07T15:30:11Z")

</div>

That sounds about right 🙂

Thanks to everyone here for helping me. For those playing at home, here’s a summary of the last 15 posts or so.

### How to make all users watch (or unwatch) a specific category through the rails console

**Set your parameters:**

```ruby
# Levels → :tracking :watching :watching_first_post :muted
level = :watching
category_slug = "announcements"

```

**And then,** to make everyone watch (or whatever level you set) this category:

```plaintext
User.all.each do |user| CategoryUser.batch_set(user, level, [Category.find_by_slug(category_slug)]) end

```

**Or** to make everyone unwatch (or whatever level you set) this category:

```plaintext
CategoryUser.where(category_id: Category.find_by_slug(category_slug), notification_level: CategoryUser.notification_levels[level]).delete_all

```

And there you have it! 🎉

⚠ Warning: unlike the OP, this is a destructive change in the sense that it disregards users’ current settings.

---

_[View the full topic](https://meta.discourse.org/t/obsolete-set-category-tracking-level-defaults-historically/53165)._
