简体   繁体   English

如何强制Rails使用版本X的gem

[英]How to force Rails to use gem of version X

I have a rails app with the config/environment.rb line 我有一个带有config / environment.rb行的rails应用程序

config.gem 'authlogic', :version => '2.1.2'

The system gem for authlogic is 2.1.4 The one in my GEM_PATH is 2.1.2 authlogic的系统gem是2.1.4。我的GEM_PATH中的一个是2.1.2

No matter what I try, Rails is only using the 2.1.4 version, which is a problem. 无论我尝试什么,Rails只使用2.1.4版本,这是一个问题。 How to force rails to use 2.1.2? 如何强制使用rails 2.1.2?

Thanks 谢谢

我建议使用Bundler

i've made a test here, included the gem authlogic, choose to use the 2.1.3 version, and the application ran without problems. 我在这里做了一个测试,包括gem authlogic,选择使用2.1.3版本,应用程序运行没有问题。

then i've uninstalled the gem (gem uninstall authlogic -v=2.1.3), and my application didn't ran anymore, normal behavior (i'm using rails 2.3.8 for this test) 然后我卸载了gem(gem uninstall authlogic -v = 2.1.3),我的应用程序不再运行,正常行为(我正在使用rails 2.3.8进行此测试)

you could try uninstalling and then installing the gem again 您可以尝试卸载然后再次安装gem

为安全起见,请卸载2.1.4版本,冻结2.1.2,然后再卸载2.1.2。

Unpack the gems into your rails app. 将宝石打包到您的rails应用程序中。 This'll also help in deployment. 这也有助于部署。

rake gems:unpack

系统管理员重新安装了一些宝石,所有问题都消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM