Skip to content

Instantly share code, notes, and snippets.

@standout
Created August 13, 2009 12:56
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save standout/167152 to your computer and use it in GitHub Desktop.
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