Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Protect against bots and other spam producers with simple mathematical questions

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 ankh.gemspec


Ankh is the ancient Egyptian sign of life.

Use Ankh in your Rails (>= 3.0) projects to protect against bots and other spam producers. It asks a simple arithmatic question to verify that the poster is human.

In your activerecord model:

class Post < ActiveRecord::Base
  validates_human :on => :create

Ankh is also available for ActiveModel objects:

class Foo
  include ActiveModel::Validations
  extend Ankh::Model
  validates_human :on => :create

In your view (Rails 2 syntax shown below):

<%- obj.generate_human_question %>
<%- form_for obj do |f| -%>
  <%= f.label :human_answer, obj.human_question %>
  <%= f.text_field :human_answer %>
  <%= f.hidden_field :salted_human_answer %>
<%- end -%>


  • Nice form helpers

  • I18n support

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Copyright © 2011 Dan Pickett. See LICENSE for details.

Something went wrong with that request. Please try again.