Ruby-on-rails 如何避免 activesupport 中的循环参数引用警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27717309/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:01:54  来源:igfitidea点击:

How do I avoid the circular argument reference warning in activesupport

ruby-on-railsactivesupport

提问by Rpj

How do I avoid the circular argument reference warning in activesupport. Happens on ruby 2.2.0

如何避免 activesupport 中的循环参数引用警告。发生在 ruby​​ 2.2.0

/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/ruby-ole-1.2.11.7/lib/ole/types/base.rb:265: warning: duplicated key at line 266 ignored: 4095

采纳答案by Dipak Gupta

This is compassissue here. They haven't release new version yet so you may need to wait for it.

这是指南针的问题在这里。他们还没有发布新版本,所以你可能需要等待。

回答by shilovk

Use Rails 3.2.22

使用 Rails 3.2.22

gem 'rails', '3.2.22'

OR

或者

warning fixes in version 1.2.11.8:

版本 1.2.11.8 中的警告修复:

bundle update ruby-ole

回答by Tsutomu

This is an issue of Active Support and has been fixed with these two commits:

这是 Active Support 的问题,并已通过以下两个提交得到修复:

Unfortunately, these commits have been never included into the 3.2 releases, because the current last release (v3.2.21) was out on 18 Nov 2014 and after thatthese commits were merged.

不幸的是,这些提交从未包含在 3.2 版本中,因为当前的最后一个版本 (v3.2.21) 于 2014 年 11 月 18 日发布,之后这些提交被合并。

If you don't want to see this warning message definitely, you should change your Gemfilelike this:

如果你不希望看到此警告消息肯定,你应该改变你的Gemfile是这样的:

# gem 'rails', '3.2.21'
gem 'rails', git: 'https://github.com/rails/rails.git', branch: '3-2-stable'

Otherwise, you should downgrade ruby to 2.1 or wait the release of v3.2.22, which won't come until a grave security hole is found.

否则,您应该将 ruby​​ 降级到 2.1 或等待 v3.2.22 的发布,直到发现严重的安全漏洞才会出现。

After all, there is no easy way to avoid this issue. Changing Gemfilefor such a trivial annoyance may be an overreaction in my view. It will delay your deployment process quite a lot.

毕竟,没有简单的方法可以避免这个问题。Gemfile在我看来,为了这种微不足道的烦恼而改变可能是一种过度反应。它会大大延迟您的部署过程。

回答by ScottJShea

I was not using compass in my application Based on this post hereI upped my Rails version from 4.1.1 to 4.1.9 which worked.

我没有在我的应用程序中使用指南针基于这篇文章我将我的 Rails 版本从 4.1.1 升级到 4.1.9,它起作用了。

回答by Code Tree

here is what i did to resolve that, i had the latest ruby and the gems are not compatible with that, so after having a fight for nearly a day i switched to older ruby version using rvm

这是我为解决这个问题所做的工作,我有最新的 ruby​​,但 gems 与它不兼容,所以在战斗了将近一天后,我使用 rvm 切换到旧的 ruby​​ 版本

from ruby-2.2.1 to ruby-2.0.0 ,

从 ruby​​-2.2.1 到 ruby​​-2.0.0 ,

again this is not an issue with ruby version but incompatibility with gems,try and have good luck with that.

同样,这不是 ruby​​ 版本的问题,而是与 gems 不兼容,请尝试并祝你好运。

回答by Satyam Singh

Well, Here is a solution to this: Try doing all these changes in your .rbenv/.rvm folder and change in these files:

好吧,这是一个解决方案:尝试在 .rbenv/.rvm 文件夹中进行所有这些更改并更改这些文件:

https://github.com/tmm1/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7

https://github.com/tmm1/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7

回答by Rachel C.

Hypothetically, updating to Rails 4.2.0 - which you should be able to do via the following commands - should fix this error, although it hasn't worked for me:

假设更新到 Rails 4.2.0(您应该可以通过以下命令进行)应该可以修复此错误,尽管它对我不起作用:

rvm use [email protected] --create
gem install rails 
rails -v 

I'm getting the same "circular argument error" message as well (I posted more about my failed attempts to fix it here, will update if I find an answer: Rails gem update not working (version 4.1.1 to 4.2.0) as a solution to "warning: circular argument reference" error).

我也收到了相同的“循环参数错误”消息(我在这里发布了更多关于我尝试修复它失败的信息,如果我找到答案就会更新:Rails gem update not working (version 4.1.1 to 4.2.0)作为“警告:循环参数引用”错误的解决方案)。

回答by Hamzeen Hameem

I ran into the same issue as well, yo can sue the following steps to resolve it (worked for me).

我也遇到了同样的问题,你可以起诉以下步骤来解决它(对我有用)。

$ gem uninstall compass
$ gem update --system
$ gem install compass

回答by tomb

I altered the time_zone.rb file, instead of now=now, I entered now=Time.nowand problem solved.

我更改了 time_zone.rb 文件,而不是now=now,我输入now=Time.now并解决了问题。