# How to get the current user using Ruby?

**URL:** https://meta.discourse.org/t/how-to-get-the-current-user-using-ruby/314149
**Category:** Development
**Created:** [June 28, 2024, 10:15am UTC](https://meta.discourse.org/t/how-to-get-the-current-user-using-ruby/314149 "2024-06-28T10:15:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![omppatil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omppatil/32/359876_2.png) [@omppatil](https://meta.discourse.org/u/omppatil)
#### Post date: [June 28, 2024, 10:15am UTC](https://meta.discourse.org/t/how-to-get-the-current-user-using-ruby/314149/1 "2024-06-28T10:15:41Z")

</div>

Hello everyone!,  
I want to get the current user without need of providing **id** or **username** or **post id** using Ruby not by using JS.Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [June 28, 2024, 2:14pm UTC](https://meta.discourse.org/t/how-to-get-the-current-user-using-ruby/314149/2 "2024-06-28T14:14:50Z")

</div>

It would be helpful to know the context. Can you post a code snippet? On the server the `current_user` is set automatically in controller actions – no need to manually look up the user. Here is an example:

> <https://github.com/discourse/discourse/blob/232503b3df5e1180efdde0f23ea56acb0b926ebc/app/controllers/drafts_controller.rb#L15>
