# How do I access the Ruby REPL?

**URL:** https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560
**Category:** Support
**Created:** [January 28, 2021, 3:54pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560 "2021-01-28T15:54:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alexweej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexweej/32/120813_2.png) [@alexweej](https://meta.discourse.org/u/alexweej)
#### Post date: [January 28, 2021, 3:54pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/1 "2021-01-28T15:54:46Z")

</div>

I seem to remember, several years ago, being able to enter the container and bring up a Ruby REPL where I could interactively use Discourse ORM objects etc. I am trying to debug an issue and want to inspect the posts in a topic, but I can no longer find evidence of this REPL with my Google searches!

Is this still possible?

Thanks!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 28, 2021, 3:57pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/2 "2021-01-28T15:57:54Z")

</div>

```plaintext
cd /var/discourse
./launcher enter app
rails c

```

---

<div class="post-metadata">

### Author: ![alexweej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexweej/32/120813_2.png) [@alexweej](https://meta.discourse.org/u/alexweej)
#### Post date: [January 28, 2021, 4:16pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/3 "2021-01-28T16:16:58Z")

</div>

Thanks - it doesn’t ring any bells, but it does seem to work! My next question is where is this API documented? I believe this is more or less the same API that plugins use, right? I need to edit a post, for example.

Thanks again!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 28, 2021, 4:20pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/4 "2021-01-28T16:20:45Z")

</div>

This is not really an API, but the standard Rails console. It runs Ruby code in a REPL with the Discourse Rails application loaded. So for example you can use the ActiveRecord API:

```ruby
p = Post.last
puts p.raw

```

---

<div class="post-metadata">

### Author: ![alexweej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexweej/32/120813_2.png) [@alexweej](https://meta.discourse.org/u/alexweej)
#### Post date: [January 28, 2021, 4:58pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/5 "2021-01-28T16:58:58Z")

</div>

Thanks, I was able to edit a post’s raw content and call `p.save` to work around our problem. Much appreciated!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 27, 2021, 4:58pm UTC](https://meta.discourse.org/t/how-do-i-access-the-ruby-repl/177560/6 "2021-02-27T16:58:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
