Ruby on rails 为什么未初始化常量HomeController::Hidemyas?
我想不出我做错了什么 使用gem作为代理 使用github示例代码Ruby on rails 为什么未初始化常量HomeController::Hidemyas?,ruby-on-rails,ruby,Ruby On Rails,Ruby,我想不出我做错了什么 使用gem作为代理 使用github示例代码 class HomeController < ApplicationController require 'hidemyass' def index HideMyAss.options[:max_concurrency] = 3 response = HideMyAss.get("www.google.com", timeout: 2) e
class HomeController < ApplicationController
require 'hidemyass'
def index
HideMyAss.options[:max_concurrency] = 3
response = HideMyAss.get("www.google.com", timeout: 2)
end
end
试图寻找来源,但运气不佳。也许是我的代码有问题。Gemfile很好,并尝试查看所有导致问题的因素。无需编写
要求“hidemyas”
您只需将
gem'hidemyas'
添加到Gemfile中,然后进行捆绑安装
。使用gem list hidemyas
命令检查安装。我已经成功地检查了它并使用了github示例。它运行良好且平稳 如果您尝试::hidemyas.options
…?您可以尝试::hidemyas.options[]和::hidemyas.get()您是否进行了“bundle安装”?@SergioTulentsev这样做会抛出“未定义的hidemyas:Module”方法“options”错误。@emaillenin bundle安装,重新启动服务器。我得到以下响应**[hidemyas]通过:ETHON:started MULTI-ETHON:performed EASY url=response\u code=0 return\u code=recv\u error total\u time=0.839136**[hidemyas]:0 ETHON:performed EASY url=response\u code=200 return\u code=ok total\u time=0.424153**[hidemyas]:200 ETHON:performed EASY url=response\u code=200 return\u code=ok total\u time=1.645974**[hidemyas]:200 ETHON:performed EASY url=response\u code=0…..gem list hidemyas显示***本地gem***hidemyas(0.0.9)。我没有做任何不同的事情,你能详细说明你为实现这一点而采取的任何其他步骤吗?我只是按照github的例子和上面提到的步骤。。。。我使用了ruby 1.9.2系列和rails 3.2…使用rails 4.0.2和ruby 2.0,这是否意味着这就是问题所在?不,这不可能是问题。。。。我刚刚在ruby-2.0.0-p247上运行的rails 4.0.2示例应用程序上使用“Hidemyas”gem进行了测试,得到了与控制台上第一条评论相同的日志,响应对象看起来像#0,:total_time=>1.668989,:starttransfer_time=>1.515321,。。。。。
uninitialized constant HomeController::HideMyAss