Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Super simple spam protection for Ruby on Rails
<% form_for @comment do |f| %>
...
<p style="width: 1px; height: 1px; overflow: hidden;">
Lämna följande fält tomt:
<%= f.text_area :comment %>
</p>
<% end %>
class Post < ActiveRecord::Base
attr_accessor :comment # fake attribute used for spam trapping
validates_length_of :comment, :in => 0..1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment