Ruby on Rails: unloadable

前端 未结 1 1815
傲寒
傲寒 2021-02-18 18:23

What does unloadable do?

I saw this in the pages controller of High Voltage by thoughtbot. thoughtbot blogs about unloadable, but am still unclear on what i

1条回答
  •  长情又很酷
    2021-02-18 18:33

    It means that when you're running on an environment configured with cache_classes = false (like the development environment) these classes are going to be reloaded by Rails on every request, so you can place them inside your lib folder or inside a plugin and they will always be reloaded without you having to restart the app (as classes inside lib or plugins are not reloaded by rails on every request by default).

    This is mostly useful when you're building a plugin and you would like to do live changes on it without having to go through the process of always restarting your app on every test.

    You can see the unloadable method documentation here.

    0 讨论(0)
提交回复
热议问题