连接失败:domain.com(NoMethodError:未定义方法“>”对于 true:TrueClass)

发布于 2024-12-15 12:16:28 字数 731 浏览 2 评论 0原文

我不知道发生了什么,这让我脱光了头发!

我试图使 cap:deploy 命令起作用,然后,不知何故,我收到此错误: 连接失败:domain.com(NoMethodError:未定义方法>' for true:TrueClass)`

我根本没有编辑代码。为了尝试找出问题所在,我开始逐行删除deploy.rb文件中的行,我意识到如果不存在这三行中的至少一行,则不会发生错误。

role :web, "domain.com"
role :app, "domain.com"
role :db,  "domain.com", :primary => true

然后当然它给了我另一个关于服务器不存在的错误。知道什么可能会给我这个错误吗?

就在出现此错误之前,我试图将其设置正确...

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_bin_path, "$HOME/.rvm/bin/"
set :rvm_path, "/usr/local/rvm/"
set :rvm_ruby_string, '1.9.2-p290'
set :rvm_type, :user

但如果我删除这些行并再次运行 cap deploy:setup ,它仍然会给我相同的错误。

不知道是什么原因造成的!

I have no idea what happened and this is leaving me hairless!

I was trying to make the cap:deploy command work, then, out of nowhere, i get this error:
connection failed for: domain.com (NoMethodError: undefined method>' for true:TrueClass) `

I did not edit the code at all. To try to pinpoint where the problem is, I started deleting line by line in the deploy.rb file and i realized that if there is not at least one of these 3 lines present, the error doesn't happen.

role :web, "domain.com"
role :app, "domain.com"
role :db,  "domain.com", :primary => true

and then of course it gives me another error about servers not being present. any idea what could be giving me this error?

Just prior to getting this error I was trying to set this right...

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_bin_path, "$HOME/.rvm/bin/"
set :rvm_path, "/usr/local/rvm/"
set :rvm_ruby_string, '1.9.2-p290'
set :rvm_type, :user

but if i delete those lines and run cap deploy:setup again it still gives me the same error.

NO IDEA WHAT CAUSED IT!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哆兒滾 2024-12-22 12:16:28

每当您看到这样的错误时:

undefined method > for [class]

我通常发现这是由于定义的 symbol =>; value

在这种情况下,你的值是 >对于 true:TrueClass,所以尝试去掉 , :primary =>; true

如果这是罪魁祸首,请检查部署文件中的设置,或者查看您定义的符号是否实际存在/适用,或者您的语法是否正确。

在我的一个例子中,我有一个 if 语句,例如:

XXX, if :symbol > 0 

在导致错误的模型中,我需要将其转换为 Proc

(我扩展了一些额外的内容)以防其他人出于不同原因使用相同的未定义方法。)

Whenever you see an error that says:

undefined method > for [class]

I've usually found that it's due to a definition's symbol => value

In this case, yours says > for true:TrueClass, so try taking off the , :primary => true

If that's the culprit, either check your settings in your deploy file or see if the symbol you defined is one that actually exists / applies, or if your syntax is correct.

In one case for mine, I had an if statement like:

XXX, if :symbol > 0 

in a model that caused the error, and I needed to convert it into a Proc

(I expanded a little extra just in case others have the same undefined method for a different reason.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文