如何在rails应用程序中强制使用gem版本?

Ale*_*tin 2 rubygems ruby-on-rails ruby-on-rails-3

我需要使用可寻址的2.2.4 gem,但我有2.2.5版本(因为这里讨论了一个问题:https://github.com/sporkmonger/addressable/pull/33).我试过了:

source 'http://rubygems.org'
source 'http://gems.github.com'
gem "addresable", "2.2.4"

bundle install
Run Code Online (Sandbox Code Playgroud)

得到 Could not find gem 'adressable (= 2.2.4, runtime)' in any of the gem sources listed in your Gemfile.

如果我手动安装/卸载gem

sudo gem install addressable -v 2.2.4
sudo gem uninstall addressable -v 2.2.5
Run Code Online (Sandbox Code Playgroud)

我犯了同样的错误.

那么,我怎么能为我的应用强制2.2.4版本?

cor*_*ard 8

  1. 你的宝石系列中有拼写错误的"可寻址".
  2. 您的软件包可能会被锁定在2.2.5 - 尝试运行bundle update.这是违反直觉的,但它会用指定的版本重建你的Gemfile.lock.
  3. 您不再需要gems.github.com作为源 - 他们不再构建它并推荐rubygems.org.