# דריסת שיטות 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:** 1

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [13 ביוני,‏ 2023,‏ 8:17am UTC](https://meta.discourse.org/t/overriding-include-methods-in-serializers/268138/1 "2023-06-13T08:17:32Z")

</div>

Hey @david,

Just a quick question on the thinking behind this deprecation

> Deprecation notice: add\_to\_serializer should not be used to directly override include\_\*? methods

Context: [DEV: Improve add\_to\_serializer include\_\* options (#21220) · discourse/discourse@26b7f8a · GitHub](https://github.com/discourse/discourse/commit/26b7f8a63bfdb6505b605077a4beb962a9be7b97)

I understand the desire to move folks to the `include_condition` argument in a standard use of the `add_to_serializer` method, i.e. to add their own methods to serializers.

However there are some instances in which a plugin may want to add an include\_\* method to a serializer that don’t match that case, i.e. when you’re not determining whether your own custom attribute is included, but you’re overriding an include\_\* method in a core serializer, e.g.

> <https://github.com/paviliondev/discourse-custom-wizard/blob/main/plugin.rb#L181>

Core method: [discourse/app/serializers/site\_serializer.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/app/serializers/site_serializer.rb#L197)

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, but I’m wondering whether there’s an inherent downside in allowing such use of the `add_to_serializer` method in this way, and whether the deprecation will lead to a removal of the use of the method in this way.

---

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