# Как использовать свой валидатор в плагине?

**URL:** <https://meta.discourse.org/t/how-do-i-use-my-validator-in-the-plugin/140839>\
**Category:** Development\
**Created:** [06.Февраль.2020 10:20:15 UTC](https://meta.discourse.org/t/how-do-i-use-my-validator-in-the-plugin/140839 "2020-02-06T10:20:15Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [05.Июнь.2020 20:41:53 UTC](https://meta.discourse.org/t/how-do-i-use-my-validator-in-the-plugin/140839/5 "2020-06-05T20:41:53Z")

</div>

> [@Dev\_Work](#):
>
> Как использовать мой валидатор в плагине?

Вчера я искал пример того, как это сделать. Пример, который я нашел в репозитории Discourse, находится здесь: [GitHub - discourse/discourse-chat-integration · GitHub](https://github.com/discourse/discourse-chat-integration). Вы увидите, что в файле `plugin.rb` этого плагина класс валидатора подключается следующей командой:

```plaintext
require_relative "lib/discourse_chat/provider/slack/slack_enabled_setting_validator"

```

Чтобы Discourse мог найти валидатор, его необходимо подключить до вызова `after_initialize`.

---

_[View the full topic](https://meta.discourse.org/t/how-do-i-use-my-validator-in-the-plugin/140839)._
