2015-10-15 52 views
0
class DomaincheckerController < ApplicationController 
    def index 
    end 
    def store 
    r =Whois.whois(secure_params['domain']) 
    render :text => "#{r}" 
    end 

    private 
    def secure_params 
    params.require(:whois).permit(:domain) 
    end 


end 

这是我的domainchecker控制器。索引方法呈现一个表单。提交表单后,它将转到存储方法。这里我试图使用whois宝石。我通过运行gem install whois安装了whois gem。但我得到这个错误。Whois gem无法在导轨上工作

uninitialized constant DomaincheckerController::Whois 
+0

这些情况下的标准问题:安装gem后是否重新启动了服务器? – BroiSatse

+0

@BroiSatse是的,我已经重新启动niginx以及独角兽 – Raaz

+0

你是如何重新启动独角兽的? USR2?你需要做硬重启。不需要重新启动nginx。 – BroiSatse

回答

1

的问题是你而不是直接安装宝石使用bundler,因此Rails应用程序无法找到的依赖。

为了在Rails项目中安装gem,您需要编辑Gemfile文件并在其中添加gem。一旦添加,运行

$ bundle 

为了安装依赖关系。检查documentation about the Gemfile