这是一个时髦的验证码,它会问问题而不是显示图片。你可以在textcaptcha.com上读到它。不管怎么说。我想把它用在Ruby on Rails上。一位名叫Matt Hutchinson的开发人员写了一个Gem,以便轻松连接到API。他有一台set of instructions next to his source files on github。无论如何,它看起来很简单,但在尝试实现它的过程中,我每次都会遇到这个错误:
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'我的问题的根源与这个特定的gem关系不大,而更多的是关于gem是如何工作的。我已经安装了gem,然后将它捆绑到我的rails应用程序中,它应该是可访问的(据我所知)。我在gemfile.rb和gemfile.lock中看到了对gem的引用,但它一次又一次地告诉我使用的是未定义的方法。
gem应该为我定义方法,不是吗?或者有什么我必须手动完成的事情?
只要让我知道如果有任何其他信息将是有帮助的,谢谢!
发布于 2011-03-18 08:12:15
哦,天哪。它现在起作用了。可能是我重新启动了服务器,但我不确定。我所做的是安装RubyMine,看看我是否可以使用它的调试器,在这样做的过程中,我需要通过那里运行包安装(它选择了一些依赖项的一些不同版本),还需要停止我的另一台was服务器,以便通过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
https://stackoverflow.com/questions/5346592
复制相似问题