Rails是否会加载所有已安装的宝石? [英] Does Rails load all installed gems?

查看:95
本文介绍了Rails是否会加载所有已安装的宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Rails加载时,它是否会加载系统上安装的所有gem?我在服务器上安装了47个宝石,包括所有具有多个版本的各种Rails宝石。但是,Rails和应用程序使用的所有宝石都被冻结到应用程序中。



所有这些gem都被加载了,并且会导致应用程序运行速度更慢或占用更多内存(注意我的服务器上运行了两个应用程序实例,一个在线,另一个在测试环境中)?如果Rails正在加载所有已安装的宝石,是否有办法让它只加载冻结的宝石,而没有其他的方法?

解决方案

否,只是那些您需要或Rails需要的。


When Rails loads, does it load all the gems that are installed on the system? I've got 47 gems installed on the server, including all the various Rails gems which have multiple versions. However, both Rails, and all the gems used by the application, are frozen into the application.

Are all those gems getting loaded, and would that cause the application to run slower or take up more memory (note I've got two instances of my application running on the server, one live and one as a test environment)? If Rails is loading all the installed gems, is there a way to make it just load frozen gems and no others?

解决方案

No, just those that you require or are required by Rails.

这篇关于Rails是否会加载所有已安装的宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆