How to prevent spam in rails?

ruby-on-rails, ruby-on-rails-3, spam-prevention

Solution

For a `honeypot` solution, you can use invisible_captcha.

It works pretty nice for small and medium sites, with a simple and configurable approach.

More or less:

In your form:

<%= form_tag(create_topic_path) %>
  <%= invisible_captcha %>
  ...
<% end %>

In your controller:

class TopicsController < ApplicationController
  invisible_captcha only: [:create, :update]
  ...
end

Problem

Does anyone know how to stop spam in rails? I've tried many solutions, which all has failed. I have tried: Captcha: I am currently not a fan of captcha since it interrupts when the user is signing up but upon putting captcha on signup page bots still managed to get passed it. Honeypot: I've created a hidden field set the max character value to 0 and push the form -9999px off the screen and for some reason that does not stop the spam. askimet: While this works well with wordpress it comes with a monthly fee so I am not interested in something like this. Is there anyway to stop the spam bots in rails from signing up?

Original source