# Want to modify rails code of discourse application

**URL:** https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544
**Category:** Development
**Tags:** rails-console
**Created:** [January 3, 2023, 10:29am UTC](https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544 "2023-01-03T10:29:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kapil65](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kapil65](https://meta.discourse.org/u/kapil65)
#### Post date: [January 3, 2023, 10:29am UTC](https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544/1 "2023-01-03T10:29:30Z")

</div>

I want to modified the code of discourse from backend and change scope of some model but it will not reflect on UI, how can I modify the backend code of discourse application.  
Like I want to change the scope of some models based on my requirement want to change queries from backend, I am able to do on rails console but not able to implement on code base.  
Guide my the steps.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 3, 2023, 10:40am UTC](https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544/2 "2023-01-03T10:40:03Z")

</div>

You should [create a plugin](https://meta.discourse.org/t/how-can-i-make-my-own-discourse-plugins/90032/2) (look at example repos linked in #Customization > Plugin) so that core upgrades work as normal. Do not modify the source code ‘directly’ as that will make maintenance a total pain. Use the guides in #documentation:devs to get going. Rails Serializers will need expanding if you want to bring down more data. However consider [Custom Fields](https://meta.discourse.org/t/how-to-add-custom-fields-to-models/184485) if your needs are light.
