Ruby 在 Rails 上:Gem 依赖性问题

Ruby on Rails: Gem Dependency Issues

我正在尝试安装最新版本的 hamlsimple_formdevise 到我的 Ruby on Rails 应用程序,但我似乎无法让他们使用 Bundler 工具。我应该如何处理才能解决依赖性问题?

这是 Bundler 工具引发的错误:

Bundler 找不到 gem "activemodel" 的兼容版本:

  In snapshot (Gemfile.lock):
    activemodel (= 5.1.1)

  In Gemfile:
    rails (~> 5.1.1) was resolved to 5.1.1, which depends on
      activemodel (= 5.1.1)

    rails (~> 5.1.1) was resolved to 5.1.1, which depends on
      activemodel (= 5.1.1)

    simple_form (~> 3.4) was resolved to 3.4.0, which depends on
      activemodel (< 5.1, > 4)

    web-console (>= 3.3.0) was resolved to 3.5.1, which depends on
      activemodel (>= 5.0)

不幸的是,simple_form 与 Rails 5.1 不兼容,您可以从这个提交中看到 https://github.com/plataformatec/simple_form/commit/8d15b7ebc8096348b611e9f2905a2576a5bce508

您要么等待 simple_form 的新版本,要么使用更早的版本。

如果可以,请尝试使用 rails 版本 4.2.4 这将允许您在需要时使用 'simple_form' 和 'nested_form'。

运行 使用 --conservative 密钥更新包,它不会尝试更新 rails 依赖项,这些 gem 有。

bundle update haml simple_form devise --conservative