# דריסת שיטות include\_\* בסדרות

**URL:** <https://meta.discourse.org/t/overriding-include-methods-in-serializers/268138>\
**Category:** Development\
**Created:** [13 ביוני,‏ 2023,‏ 8:17am UTC](https://meta.discourse.org/t/overriding-include-methods-in-serializers/268138 "2023-06-13T08:17:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [13 ביוני,‏ 2023,‏ 8:40am UTC](https://meta.discourse.org/t/overriding-include-methods-in-serializers/268138/2 "2023-06-13T08:40:51Z")

</div>

> [@angus](#):
>
> I appreciate that that particular use could be re-thought to not require an override of the site serializer method, or the override could be achieved in other ways

Yeah, that would be my recommendation.

We’ve recently introduced a new system for [‘plugin modifiers’](https://github.com/discourse/discourse/commit/795e6d72a4a0665997fa72fafd5d7bf71a8a4e4c), which are super cheap extension points which are similar to DiscourseEvent **but** they take an input value and return a value. So in your case, you could make a core PR to add a `DiscoursePluginRegistry.apply_modifier` call in the relevant `include_` method, and then you can use `register_modifier` in your plugin to override the value.

> [@angus](#):
>
> deprecation will lead to a removal of the use of the method in this way.

It’s likely we’ll eventually block it completely, yes. Plus you really don’t want to be using a method that’s printing deprecation noise in the logs.

If you really must override a method without co-operation from core, then `modify_class` would seem to be the better choice. The main reason we have a dedicated `add_to_serializer` is because it auto-defines an `include_*` method so that it only applies when the plugin is enabled.

That means that the code snippet you linked is currently defining two methods. `include_wizard_required?` and `include_include_wizard_required?` 😅

---

_[View the full topic](https://meta.discourse.org/t/overriding-include-methods-in-serializers/268138)._
