[英]How do I get Ambethia Recaptcha to work with simple_form .error_notification?
[英]Ambethia recaptcha does not work
我正在將Ambethia recaptcha用於投票系統。我已遵循所有標准指南。但是,Recaptcha未通過驗證。我在Firebug中運行了控制台,並在響應中得到了這一點:
Recaptcha::RecaptchaError
in IndicesController#increment
</h1>
<pre>uninitialized constant Recaptcha::Verify::Net</pre>
這是代碼的問題還是由於webrick服務器?
編輯:這是我的控制器:
class IndexController < ApplicationController
def display
@digits=Digit.all
end
def increment
@digit= Digit.find(params[:id])
if verify_recaptcha
@digit.increment!(:value)
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js {render 'fail.js.erb'}
end
end
end
end
這是視圖:
<%@digits.each do |c|%>
<h1><%=c.value%></h1>
<p id="fail" style="display:none">Incorrect recaptcha</p>
<p id="para" style="display:none">Succesfully Incremented</p>
<%=recaptcha_tags%>
<%=button_to 'Increment',increment_path(:format=>:js,:id=>c.id),:remote=>true%>
<%end%>
如果使用RVM,請打開以下文件:
/gems/ambethia-recaptcha-0.2.2/lib/recaptcha/rails.rb 〜/ .rvm / gems / /gems/ambethia-recaptcha-0.2.2/lib/recaptcha/rails.rb
並確保頂部有以下兩行:
require 'net/http'
require 'recaptcha'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.