# Getting the NoMethodError error when editing the topic due to my plugin

**URL:** <https://meta.discourse.org/t/getting-the-nomethoderror-error-when-editing-the-topic-due-to-my-plugin/59471>\
**Category:** Development\
**Created:** [March 19, 2017, 7:55am UTC](https://meta.discourse.org/t/getting-the-nomethoderror-error-when-editing-the-topic-due-to-my-plugin/59471 "2017-03-19T07:55:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![net\_deamon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/net_deamon/32/70126_2.png) [@net\_deamon](https://meta.discourse.org/u/net_deamon)\
**Post date:** [March 19, 2017, 11:14am UTC](https://meta.discourse.org/t/getting-the-nomethoderror-error-when-editing-the-topic-due-to-my-plugin/59471/3 "2017-03-19T11:14:11Z")

</div>

EDIT

Thanks, I tried the above code , and it worked.  
Thankyou

I was trying something on similar lines

Here they watch the topic\_guuid

> <https://github.com/cos-archives/discourse-osf-projects/blob/master/plugin.rb#L236>

Then they get that value in before\_create\_topic event

> <https://github.com/cos-archives/discourse-osf-projects/blob/master/plugin.rb#L250>

I am able to save the custom model to topic, but when I try to edit the first post of topic, it throws error.  
If I comment out the PostRevisor code, the error dosent come. So I think it is due to PostRevisor only.

> [@gdpelican](#):
>
> if you’re tracking a topic field you also need to provide what to do once that field has changed.

I do not have to do anything if value changes, I just need to get the value from UI and use it in plugin.rb to save it to topic. And it throws only in when editing the first post of topic. In the postrevisor class, I kept breakpoint to see

```
def update_topic
    Topic.transaction do
      PostRevisor.tracked_topic_fields.each do |f, cb|

        if !@topic_changes.errored? && @fields.has_key?(f)
          cb.call(@topic_changes, @fields[f])
        end
      end

      unless @topic_changes.errored?
        @topic_changes.check_result(@topic.save(validate: @validate_topic))
      end
    end
  end

```

Here in the PostRevisor.tracked\_topic\_fields array, the value for testid is “nil”.  
Here is the snippet. When it comes to testid, it throws error

`{:title=>#<Proc:0x007f8e5e3f9258@/Users/santosh/discourse/lib/post_revisor.rb:65>, :category_id=>#<Proc:0x007f8e5ad8b130@/Users/santosh/discourse/lib/post_revisor.rb:70>, :tags=>#<Proc:0x007f8e5ad8a438@/Users/santosh/discourse/lib/post_revisor.rb:75>, :tags_empty_array=>#<Proc:0x007f8e5ad8a348@/Users/santosh/discourse/lib/post_revisor.rb:87>, :featured_link=>#<Proc:0x007f8e5ad895b0@/Users/santosh/discourse/lib/post_revisor.rb:98>, :testid=>nil}`

---

_[View the full topic](https://meta.discourse.org/t/getting-the-nomethoderror-error-when-editing-the-topic-due-to-my-plugin/59471)._
