[英]How do I correctly install ambethia/recaptcha with rails 3
I have done the following steps: 我已完成以下步骤:
Added to gemfile: 添加到gemfile:
gem "recaptcha"
Added to config/initializers/recaptcha.rb 添加到config / initializers / recaptcha.rb
Recaptcha.configure do |config|
config.public_key = 'MyKeyHere'
config.private_key = 'MyKeyHere'
end
Added to view: 添加查看:
= raw recaptcha_tags
Ran: bundle install Ran:捆绑安装
...then restarted server. ...然后重新启动服务器。 The result? 结果?
undefined local variable or method `recaptcha_tags' for #<#<Class:0x1053baaa0>:0x1053b69c8>
The gem's README says to, in Rails 2 (yes, I know you're in 3—just a minute :D), include the following line to require the gem: 宝石的自述文件说,在Rails 2中(是的,我知道你只有3分钟:D),包含以下行来要求宝石:
config.gem "recaptcha", :lib => "recaptcha/rails"
The important bit to note here is the instruction that Rails should essentially end up running require 'recaptcha/rails'
. 这里要注意的重要一点是Rails应该最终运行的指令require 'recaptcha/rails'
。 Your current Gemfile doesn't have that specified, so it may very well only be loading in the gem's core classes, not the Rails-specific tie-ins. 你当前的Gemfile没有指定,所以它很可能只加载在gem的核心类中,而不是Rails特定的绑定。
Try: 尝试:
gem 'recaptcha', :require => 'recaptcha/rails'
将以下gem添加到gemfile中。
gem 'recaptcha', :require => 'recaptcha/rails'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.