开发者

Ambethia recaptcha does not work

I am Using Ambethia recaptcha for a voting system.I have followed all the stan开发者_StackOverflowdard guidelines.But, recaptcha is not validated.I ran console in Firebug and i got this in the response:

Recaptcha::RecaptchaError
    in IndicesController#increment
</h1>
<pre>uninitialized constant Recaptcha::Verify::Net</pre>

Is this the problem with code or is it because of webrick server?

Edit: Here's my controller:

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

here is the view:

<%@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%>


If you use RVM, open the following file:

~/.rvm/gems/name_of_your_gemset/gems/ambethia-recaptcha-0.2.2/lib/recaptcha/rails.rb

And make sure you have the following two lines at the top:

require 'net/http'
require 'recaptcha'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜