且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何同时使用不同版本的gem

更新时间:2023-01-04 18:58:00

使用单个gem的两个版本通常意味着:使用同一类的两个版本.

Using two versions of a single gem usually means: use two versions of the same class.

不对这些宝石进行修改是不可能的.您可以尝试将创建的类放在某个模块中,解决导入到其他类中的方法中的冲突,等等.通常,这不是一件容易的事,而且通常效果不值得.

It's not possible without making modifications to these gems. You may try to place created classes in some module, resolve conflicts in methods imported into other classes, and so on. In general, it is not easy task, and usually the effect is not worth it.

在这种情况下,您应该要做的是让gem维护者更新依赖项,或者尝试自己做.

What you should do in such cases is to ask the gem maintainers to update the dependencies, or try to do it yourself.

也许您可以将这些gem之一降级(使用较旧的版本),使其降级为依赖项相同的版本.

Maybe you can downgrade (use older version of) one of these gems, to the version in which the dependencies were the same.