# Modify Ember model class using Theme Component

**URL:** https://meta.discourse.org/t/modify-ember-model-class-using-theme-component/168490
**Category:** Development
**Created:** [October 28, 2020, 7:51am UTC](https://meta.discourse.org/t/modify-ember-model-class-using-theme-component/168490 "2020-10-28T07:51:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Saurabh\_Khandelwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabh_khandelwal/32/156332_2.png) [@Saurabh\_Khandelwal](https://meta.discourse.org/u/Saurabh_Khandelwal)
#### Post date: [October 28, 2020, 7:51am UTC](https://meta.discourse.org/t/modify-ember-model-class-using-theme-component/168490/1 "2020-10-28T07:51:04Z")

</div>

Hi All,

I want to modify below mention method of topic model class `javascripts/discourse/app/models/topic.js`

```plaintext
    @discourseComputed("excerpt")
      excerptTruncated(excerpt) {
        return excerpt && excerpt.substr(excerpt.length - 8, 8) === "&hellip;";
      }

```

Tried using below code but its not working:

```
<script type="text/discourse-plugin" version="0.8">

const topicClass = api.container.factoryFor('model:topic');
const discourseComputed = require("discourse-common/utils/decorators").default;

topicClass.class.reopenClass({
  @discourseComputed("excerpt")
  excerptTruncated(excerpt) {
	return excerpt && excerpt.substr(topic_excerpt.length - 8, 8) === "&hellip;";
  }
});
</script>

```

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [October 28, 2020, 8:10am UTC](https://meta.discourse.org/t/modify-ember-model-class-using-theme-component/168490/2 "2020-10-28T08:10:49Z")

</div>

You can directly do

```plaintext
api.modifyClass('model:topic', {
});

```
