I've seen a few guides for how to use the new recaptcha with PHP, but none with Rails. This is the code I have so far:
<script src='https://www.google.com/recaptcha/api.js'></script>
<%= form_for @user, :url => users_path, :html => { :multipart => true } do |f| %>
<%= f.text_field :name %>
<div class="g-recaptcha" data-sitekey="..."></div>
<%= f.submit "Submit" %>
<% end %>
users_controller.rb
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
redirect_to users_success_path
else
flash[:notice] = "Failed"
redirect_to new_user_path
end
end
How can I verify the response as true or false? Google's documentation on this subject is extremely confusing.