# Help building plugin that requires overriting ruby controller methods

**URL:** <https://meta.discourse.org/t/help-building-plugin-that-requires-overriting-ruby-controller-methods/259129>\
**Category:** Development\
**Created:** [March 23, 2023, 9:52am UTC](https://meta.discourse.org/t/help-building-plugin-that-requires-overriting-ruby-controller-methods/259129 "2023-03-23T09:52:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Pabs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pabs/32/299271_2.png) [@Pabs](https://meta.discourse.org/u/Pabs)\
**Post date:** [March 23, 2023, 9:52am UTC](https://meta.discourse.org/t/help-building-plugin-that-requires-overriting-ruby-controller-methods/259129/1 "2023-03-23T09:52:37Z")

</div>

Hi there,  
I’m trying to create a plugin that surfaces a checkbox when creating a topic on the UI, and that basically saves a new attribute in the topics table. Basically I need to get the attribute saved whehter the checbox was clicked or not, and then surface the new attrbute when visiting a Topics page.  
I started from the backend, adding a migration that creates a new boolean attribute to Topics, defaulted to false and next I was working on the controller. But I haven’t been able to find a way to add the new attribute in the function posts from TopicsController.  
I couldnt find anything like this on the tutorials.  
Thanks in advance!

```plaintext
after_initialize do

  module ::DiscourseXPlugin
    class ::TopicsController

      def posts
        Rails.logger.info '┌────────────┐'
        Rails.logger.info '│ Here we go │'
        Rails.logger.info '└────────────┘'  
      end
    end
  end
end

```

---

_[View the full topic](https://meta.discourse.org/t/help-building-plugin-that-requires-overriting-ruby-controller-methods/259129)._
