From 92817d701a8389812d1472a339bbad47c96eaf99 Mon Sep 17 00:00:00 2001 From: bwyrosdick Date: Tue, 25 Mar 2008 01:32:02 -0500 Subject: [PATCH] added README and performed minor cleanup --- LICENSE | 2 -- README | 11 +++++++++++ lib/less_captcha.rb | 6 ++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index cb23ad4..04575bf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,3 @@ - - The MIT license: Copyright (c) 2008 Less Everything, Inc. diff --git a/README b/README index e69de29..2977fd3 100644 --- a/README +++ b/README @@ -0,0 +1,11 @@ +Less Captcha creates a user friendly, bot unfriendly image CAPTCHA alternative + +== In the model + +class User < ActiveRecord::Base + validates_captcha +end + +== In the view + +<%= captcha_field("user") %> \ No newline at end of file diff --git a/lib/less_captcha.rb b/lib/less_captcha.rb index 74f594a..770c751 100644 --- a/lib/less_captcha.rb +++ b/lib/less_captcha.rb @@ -56,9 +56,8 @@ module Helper # # the following HTML will be generated. The hidden field contains an encrypted version of the answer # - #

Challenge Question

- # # + # # # You can use the +options+ argument to pass additional options to the text-field tag. def captcha_field(object, options={}) @@ -69,9 +68,8 @@ def captcha_field(object, options={}) answer = a.send(op, b) eval("@"+object.to_s).setup_captcha(answer) - result = "" + result = ActionView::Helpers::InstanceTag.new(object, PREFIX, self).to_input_field_tag("text", options) result << ActionView::Helpers::InstanceTag.new(object, PREFIX + SUFFIX, self).to_input_field_tag("hidden", {}) - result << ActionView::Helpers::InstanceTag.new(object, PREFIX, self).to_input_field_tag("text", options) end end end