未初始化的常量Request(NameError) [英] uninitialized constant Request (NameError)
问题描述
我收到这个错误: /LiveToChallenge/config/initializers/gibbon.rb:1:in'< top(required)>':未初始化的常量Gibbon :: Request(NameError) code>当我尝试启动服务器
rails server
。
app / config /初始化器/ gibbon.rb
require 'gibbon'
Gibbon::Request.api_key = "24e4a2233cd34debb76ed083dc3f8b5379-us8"
Gibbon::Request.timeout = 15
我遵循 gibbon gem 说明,看起来很简单。也许我错过了一些除了 gem install gibbon
并将 api_key
添加到初始化程序?
I followed gibbon gem instructions, which seemed simple enough. Maybe I'm missing something besides just gem install gibbon
and adding api_key
to initializer?
宝石安装为 gibbon(2.2.2,2.2.1,1.2.1)
作为附加措施,我在gemfile中放入 gem gibbon
,并运行 bundle install
And as added measure I put gem gibbon
in the gemfile and ran bundle install
此问题是更大的问题我一直在努力解决。
This problem is part of a larger problem I've been working on solving.
推荐答案
我遇到与 gibbon 2.0
版本,因为它已经更新了一些初始化方法,然后我尝试了一个以前的版本&它工作,但首先你应该尝试这样:
I experienced same issue with gibbon 2.0
version as it has updated some methods for initializations then i tried a previous version & it worked but first You should try it this way :
gibbon = Gibbon::Request.new(api_key: "MailChimp_API_Key")
gibbon.timeout = 10
如果在app / config / initializers / gibbon.rb然后你可以尝试直接在控制器中直接使用长臂猿检索或添加列表内容进行测试。
If no luck with this in app/config/initializers/gibbon.rb then you can try to do this direct in the controller just before using gibbon to retrieve or add list stuff for testing.
这篇关于未初始化的常量Request(NameError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!