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

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

问题描述

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

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.

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

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?

推荐答案

不,只是那些你需要或 Rails 需要的那些.

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

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

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