开发者

How do I correctly install ambethia/recaptcha with rails 3

I have done the following steps:

Added to gemfile:

gem "recaptcha"

Added to 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

...then restarted server. The result?

undefined local variable or method `recaptcha_tags' for #<#<Class:开发者_StackOverflow中文版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:

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'. 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.

Try:

gem 'recaptcha', :require => 'recaptcha/rails'


Add the following gem into your gemfile.

gem 'recaptcha', :require => 'recaptcha/rails'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜