Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将Gems与rubyonrails结合使用:未定义的方法?_Ruby On Rails_Ruby_Rubygems_Captcha - Fatal编程技术网

Ruby on rails 将Gems与rubyonrails结合使用:未定义的方法?

Ruby on rails 将Gems与rubyonrails结合使用:未定义的方法?,ruby-on-rails,ruby,rubygems,captcha,Ruby On Rails,Ruby,Rubygems,Captcha,这款时髦的验证码可以提问,而不是显示图片。你可以在网站上阅读。无论如何我想在RubyonRails上使用它。一个名为Matt Hutchinson的开发人员编写了一个Gem,用于轻松连接到API。他有一个好朋友。无论如何,它看起来很简单,但在尝试实现它时,每次都会出现以下错误: undefined method `acts_as_textcaptcha' for #<Class:0x104098508> Rails.root: /Users/cory/Documents/Learni

这款时髦的验证码可以提问,而不是显示图片。你可以在网站上阅读。无论如何我想在RubyonRails上使用它。一个名为Matt Hutchinson的开发人员编写了一个Gem,用于轻松连接到API。他有一个好朋友。无论如何,它看起来很简单,但在尝试实现它时,每次都会出现以下错误:

undefined method `acts_as_textcaptcha' for #<Class:0x104098508>
Rails.root: /Users/cory/Documents/Learning/RoR/dpt

Application Trace | Framework Trace | Full Trace
app/models/citation.rb:20
app/controllers/citations_controller.rb:29:in `new'
未定义的方法“作为”文本验证码#
root:/Users/cory/Documents/Learning/RoR/dpt
应用程序跟踪|框架跟踪|完整跟踪
app/models/citation.rb:20
app/controllers/citations_controller.rb:29:in'new'
我的问题的根源与这个特定的宝石关系不大,而更多的是关于宝石是如何工作的。我已经安装了gem,然后将它捆绑到我的rails应用程序中,它应该可以访问(据我所知)。我在
gemfile.rb
gemfile.lock
中看到对gem的引用,但它一次又一次地告诉我正在使用未定义的方法

创业板应该为我定义方法,不是吗?或者是我必须手工做些什么


只要让我知道,如果有任何其他信息,将是有益的,谢谢

嗯,天哪。它正在工作。可能是我重新启动了服务器,但我不能肯定。我所做的是安装RubyMine,看看我是否可以使用它的调试器,在这样做时,我需要运行bundle安装(它选择了一些不同版本的依赖项),并停止我的另一个webrick服务器,通过RubyMine控制台运行该服务器。我这样做了,它给了我错误,当我回到我的另一个安装程序时,它工作了!? 不管怎么说,我的问题已经解决了,但如果有人查这个,这些是我目前的珍宝:

$ bundle install
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.2) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.24) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.15) 
Using actionmailer (3.0.0) 
Using arel (1.0.1) 
Using activerecord (3.0.0) 
Using activeresource (3.0.0) 
Using bcrypt-ruby (2.1.4) 
Using acts_as_textcaptcha (2.2.0) 
Using bundler (1.0.10) 
Using thor (0.14.6) 
Using railties (3.0.0) 
Using rails (3.0.0) 
Using sqlite3-ruby (1.2.5) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
谢谢大家!
但是,如果您正在尝试此操作,请按照建议首先尝试重新启动服务器,我希望知道这是否有效:D

有些更改不会自动注意到,即使在
开发环境中也是如此;对于这些更改,您需要重新启动服务器。这可能是其中之一?我真的认为只要重新启动本地服务器就可以了。我不太熟悉安装gems。好吧,希望这能很好地提醒那些忘记的人