# Watching Categories based on on group in discourse

**URL:** https://meta.discourse.org/t/watching-categories-based-on-on-group-in-discourse/41488
**Category:** Development
**Created:** [2016年三月23日 18:37 UTC](https://meta.discourse.org/t/watching-categories-based-on-on-group-in-discourse/41488 "2016-03-23T18:37:39Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2016年四月11日 17:44 UTC](https://meta.discourse.org/t/watching-categories-based-on-on-group-in-discourse/41488/17 "2016-04-11T17:44:54Z")

</div>

> [@Jared\_Needell](#):
>
> Category.find\_by\_slug(“site-feedback”) doesn’t seem to work, I get a nil return
> 
> but if I do
> 
> Category.find\_by(slug: “site-feedback”) appears to return data.

This is because I added a `find_by_slug` method in `Category` model:

> <https://github.com/discourse/discourse/blob/be3a5a56ccc284b352aa65080fc6b955f73cc72a/app/models/category.rb#L454-L462>

As you can see in above snippet, this method requires both `category_slug` and `parent_category_slug`, so you will have to pass `parent_category_slug` as well if applicable.

---

_[View the full topic](https://meta.discourse.org/t/watching-categories-based-on-on-group-in-discourse/41488)._
