# Using HasCustomFields in a plugin

**URL:** <https://meta.discourse.org/t/using-hascustomfields-in-a-plugin/176469>\
**Category:** Development\
**Created:** [January 18, 2021, 5:50pm UTC](https://meta.discourse.org/t/using-hascustomfields-in-a-plugin/176469 "2021-01-18T17:50:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [January 18, 2021, 8:36pm UTC](https://meta.discourse.org/t/using-hascustomfields-in-a-plugin/176469/4 "2021-01-18T20:36:16Z")

</div>

> [@pfaffman](#):
>
> It doesn’t care what the index name is, does it?

I don’t think so, no

I think the second approach is probably the one to aim for (using `pfaffman_server_id` as the column name)

I wonder if overriding this method may help:

> <https://github.com/discourse/discourse/blob/main/app/models/concerns/has_custom_fields.rb#L69-L71>

You can check the current value on the console like

```ruby
Server.new.custom_fields_fk

```

If that’s `server_id`, then I suggest overriding that method in your `Server` model

```ruby
class Server < ...
  def custom_fields_fk
    "pfaffman_server_id"
  end
end

```

---

_[View the full topic](https://meta.discourse.org/t/using-hascustomfields-in-a-plugin/176469)._
