本文介绍了Ruby on Rails:可卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可卸载做什么?

我在高电压"的页面控制器中看到了此想法,/a>.关于 unloadable thoughtbot博客,但目前尚不清楚它的作用.

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

推荐答案

这意味着当您在配置了 cache_classes = false 的环境中运行时(例如开发>环境),这些类将在每次请求时由Rails重新加载,因此您可以将它们放置在lib文件夹中或插件中,并且它们将始终被重新加载而无需重启应用程序(因为lib或插件中的类是默认情况下,不会在每个请求上都由Rails重新加载.)

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.

这篇关于Ruby on Rails:可卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 11:15