Created
August 13, 2009 12:56
-
-
Save standout/167152 to your computer and use it in GitHub Desktop.
Super simple spam protection for Ruby on Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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