# 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:** [19 Marzo, 2017 07:55 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:** 4

<div class="post-metadata">

**Author:** ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)\
**Post date:** [19 Marzo, 2017 11:26 UTC](https://meta.discourse.org/t/getting-the-nomethoderror-error-when-editing-the-topic-due-to-my-plugin/59471/4 "2017-03-19T11:26:13Z")

</div>

I’m sensing a misunderstanding here. The definition for `PostRevisor.track_topic_field` is essentially

```ruby
def self.track_topic_field(field, &block)
  tracked_topic_fields[field] = block # store this block for later
end

```

Then, later on once the topic has changed:

```ruby
# key here is the name of the field, and value is the block we stored
# (key, value is called f, cb in the code; we're iterating over a Hash)
tracked_topic_fields.each do |key, value|
  value.call() # call the block we passed earlier. If this is nil, it will blow up
end

```

So… if you don’t pass a block to `track_topic_field`, it’s going to go badly when running that `update_topic` code, because it’s expecting a block (technically a Proc, which is an object that always responds to the `call` method) to execute as an update callback.

---

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