# Cómo la carpeta \`lib\` de los plugins se añade a \`$LOAD\_PATH\`

**URL:** <https://meta.discourse.org/t/how-lib-folder-of-plugins-are-added-to-the-load-path/204309>\
**Category:** Development\
**Created:** [23 Septiembre, 2021 13:36 UTC](https://meta.discourse.org/t/how-lib-folder-of-plugins-are-added-to-the-load-path/204309 "2021-09-23T13:36:09Z")\
**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:** [23 Septiembre, 2021 15:43 UTC](https://meta.discourse.org/t/how-lib-folder-of-plugins-are-added-to-the-load-path/204309/2 "2021-09-23T15:43:00Z")

</div>

Muchos archivos `plugin.rb` inicializan un [Rails Engine](https://edgeapi.rubyonrails.org/classes/Rails/Engine.html), lo cual añade varias cosas al path de carga.

Cuando no tenemos un Rails Engine, verás muchas llamadas a `require_relative` en la parte superior del archivo `plugin.rb` para compensar.

> [@AhmedLoud](#):
>
> Si comento la línea 671 `self.instance_eval File.read(path), path`, entonces el require no funciona.

Creo que esto se debe a que `instance_eval` está ejecutando el archivo `plugin.rb`. Si `plugin.rb` no se ejecuta, el Rails Engine nunca se crea y las rutas adicionales no se añaden al `load_path`.

---

_[View the full topic](https://meta.discourse.org/t/how-lib-folder-of-plugins-are-added-to-the-load-path/204309)._
