How to add custom field to topic?

I’m really stuck here :frowning:
I just don’t get it … what do I have to add to plugin.rb in order my plugin to have access to custom fields? As I understood, topics should already have custom field functionality by default.

I have code in pre-initializer…

    Topic.reopen({

      @property('custom_fields.bumped_at_with_button')
      bumped_at_with_button: {
        get(date_value) {
          return new Date(date_value);
        },
        set(value) {
          this.set('custom_fields.bumped_at_by_button', (value ? value.toISOString() : ''));
          return value;
        }
      }

    });

I have following section in plugin.rb…

add_to_serializer(:topic_view, :bumped_at_with_button, false) {
  object.topic.custom_fields['bumped_at_with_button']
}

But when setting value with…

topic.set('custom_fields.bumped_at_with_button')

… I get the message I pointed out in topic :frowning:

Help… anybody?

1 Like