Ruby on rails Recaptcha不可达轨道

Ruby on rails Recaptcha不可达轨道,ruby-on-rails,recaptcha,Ruby On Rails,Recaptcha,我有js的联系人表单和sendcontact操作响应,在使用reCaptchagem之前,发送联系人是有效的 gem'recaptcha',:require=>'recaptcha/rails' 公钥和私钥 recaptcha.rb 这是表单和控制器 # contact form <%= form_for Contact.new, :url => { :action => "sendcontact" }, :remote => true do |f| %&

我有js的联系人表单和sendcontact操作响应,在使用
reCaptcha
gem之前,发送联系人是有效的

  • gem'recaptcha',:require=>'recaptcha/rails'
  • 公钥和私钥
  • recaptcha.rb
这是表单和控制器

  # contact form

  <%= form_for Contact.new, :url => { :action => "sendcontact" }, :remote => true  do |f| %> 
 <div class="field">
  <%= f.label :name %><br />
  <%= f.text_field :name %>
 </div>
 <div class="field">
   <%= f.label :email %><br />
   <%= f.text_field :email %>
 </div>
 <div class="field">
   <%= f.label :message %><br />
   <%= f.text_area :message, :style => 'height:200px;width:300px;resize:vertical;' %>
 </div>
 <div class="field">
    <%= recaptcha_tags %>
 </div>
 <div class="actions">
    <%= f.submit "Send", :class => 'btn btn-success btn-large' %>
 </div>
 <% end %>

 #controller

 def sendcontact
    @contact = Contact.new(params[:contact])
    if verify_recaptcha
       @contact.save!
       respond_to do |format|
         flash.now[:notice] = 'Thank you for contacting me'
         format.js
       end
    else
       respond_to do |format|
         format.js
       end
    end
  end
#联系方式
{:action=>sendcontact},:remote=>true do | f |%>



'高度:200px;宽度:300px;调整大小:垂直;'%> “btn btn成功btn大”%> #控制器 def发送触点 @联系人=联系人。新建(参数[:联系人]) 如果验证(u recaptcha), @联系,救命! 回应待办事项|格式| flash.now[:notice]=“谢谢您联系我” format.js 结束 其他的 回应待办事项|格式| format.js 结束 结束 结束
提交表单时,始终显示通知
Recaptcha unreable

Solved

只需删除
config.proxy=http://localhost:3000/“

因为我没有使用代理和
http://localhost:3000/
不是代理,因此请验证验证码是否未发送到谷歌服务器,并显示警报“recaptcha unreachable”

超时结束时显示“Recaptcha不可访问”


这里是rescue Timeout::Error

您是否介意详细说明为什么以及如何解决此问题,以便将来的用户能够从这个答案中受益?
  # contact form

  <%= form_for Contact.new, :url => { :action => "sendcontact" }, :remote => true  do |f| %> 
 <div class="field">
  <%= f.label :name %><br />
  <%= f.text_field :name %>
 </div>
 <div class="field">
   <%= f.label :email %><br />
   <%= f.text_field :email %>
 </div>
 <div class="field">
   <%= f.label :message %><br />
   <%= f.text_area :message, :style => 'height:200px;width:300px;resize:vertical;' %>
 </div>
 <div class="field">
    <%= recaptcha_tags %>
 </div>
 <div class="actions">
    <%= f.submit "Send", :class => 'btn btn-success btn-large' %>
 </div>
 <% end %>

 #controller

 def sendcontact
    @contact = Contact.new(params[:contact])
    if verify_recaptcha
       @contact.save!
       respond_to do |format|
         flash.now[:notice] = 'Thank you for contacting me'
         format.js
       end
    else
       respond_to do |format|
         format.js
       end
    end
  end