# Unlist a topic using rails console

**URL:** <https://meta.discourse.org/t/unlist-a-topic-using-rails-console/56189>\
**Category:** Product Support\
**Tags:** unlisting\
**Created:** [23 يناير 2017، 5:16ص UTC](https://meta.discourse.org/t/unlist-a-topic-using-rails-console/56189 "2017-01-23T05:16:21Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![shahidh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shahidh/32/121310_2.png) [@shahidh](https://meta.discourse.org/u/shahidh)\
**Post date:** [23 يناير 2017، 5:16ص UTC](https://meta.discourse.org/t/unlist-a-topic-using-rails-console/56189/1 "2017-01-23T05:16:21Z")

</div>

We have a use case where we need to close all existing topics and unlist them. I have closed all topics using the rails console by executing

```plaintext
Topic.where(closed: false).find_each do |topic| 
  topic.update_status("closed", true, Discourse.system_user)
end

```

But, when I try to do the same to unlist topics by executing

```plaintext
topic.update_status("unlisted", true, Discourse.system_user)

```

I get this error:

```plaintext
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "unlisted" of relation "topics" does not exist
LINE 1: UPDATE "topics" SET "unlisted" = 't' WHERE "topics"."id" = 1

```

From which I understand that there is no `unlisted` column for the topic object.

How can I unlist a topic using console?

---

_[View the full topic](https://meta.discourse.org/t/unlist-a-topic-using-rails-console/56189)._
