Resources

Summary


Update  

In a recent version of this gem, the model helpers have since been deprecated and removed. Instead of calling the validator within your model, you can now call them in your controller on a per action basis.

For example, if you have a subject  honeypot, you can add this to your controller if you are only wanting to capture it for the create action.

invisible_captcha only: :create, honeypot: :subject, on_spam: :spam_received

private

def spam_received
  redirect_to root_path
end

# Gemfile
gem 'invisible_captcha'

# _form.html.erb
    <%= invisible_captcha %>
    <%= f.invisible_captcha :subtitle %>

# Controller
  invisible_captcha only: :send_contact, on_spam: :spam_detected
  private

  def spam_detected
    redirect_to root_path, alert: 'Spam detected'
  end

# config/initializers/captcha.rb
  InvisibleCaptcha.setup do |config|
    config.sentence_for_humans = 'If you are a human, ignore this field'
    config.error_message       = 'You are a robot!'
    config.honeypots          += 'fake_resource_title'
    config.visual_honeypots    = false
  end