humanizer 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,34 +1,41 @@
1
+ ### Humanizer 2.3.0 (2010-12-01)
2
+
3
+ * Removed the real_human attribute.
4
+ * Added an example on how to manually skip validations to the README.
5
+ * Added a note about attr_accessible to the README.
6
+
7
+
1
8
  ### Humanizer 2.2.0 (2010-11-18)
2
9
 
3
- Added translations: French, Russian.
4
- Added real_human attribute to skip validation.
10
+ * Added translations: French, Russian.
11
+ * Added real_human attribute to skip validation.
5
12
 
6
13
 
7
14
  ### Humanizer 2.1.1 (2010-09-09)
8
15
 
9
- Updated changelog.
16
+ * Updated changelog.
10
17
 
11
18
 
12
19
  ### Humanizer 2.1.0 (2010-09-09)
13
20
 
14
- Minor polishing.
15
- Support for Formtastic inline errors.
16
- Added flexibility to validations.
17
- Added translations: Dutch, Brazilian Portuguese.
21
+ * Minor polishing.
22
+ * Support for Formtastic inline errors.
23
+ * Added flexibility to validations.
24
+ * Added translations: Dutch, Brazilian Portuguese.
18
25
 
19
26
 
20
27
  ### Humanizer 2.0.0 (2010-06-30)
21
28
 
22
- Rewrite.
23
- Database and mapper agnosticism.
24
- Use locale YAML files for storage.
29
+ * Rewrite.
30
+ * Database and mapper agnosticism.
31
+ * Use locale YAML files for storage.
25
32
 
26
33
 
27
34
  ### Humanizer 1.0.0 (2010-06-27)
28
35
 
29
- Released to public.
36
+ * Released to public.
30
37
 
31
38
 
32
39
  ### Humanizer 0.0.1 (2010-06-26)
33
40
 
34
- First version created.
41
+ * First version created.
data/README.md CHANGED
@@ -17,16 +17,18 @@ Humanizer is a very simple CAPTCHA method. It has a localized YAML file with que
17
17
 
18
18
  1. In your model, include Humanizer and add the #require_human_on method, example:
19
19
 
20
- class User < ActiveRecord::Base
21
- include Humanizer
22
- require_human_on :create
23
- end
20
+ class User < ActiveRecord::Base
21
+ include Humanizer
22
+ require_human_on :create
23
+ end
24
24
 
25
25
  2. Ask the question in the form, example:
26
26
 
27
- <%= f.label :humanizer_answer, @model.humanizer_question %>
28
- <%= f.text_field :humanizer_answer %>
29
- <%= f.hidden_field :humanizer_question_id %>
27
+ <%= f.label :humanizer_answer, @model.humanizer_question %>
28
+ <%= f.text_field :humanizer_answer %>
29
+ <%= f.hidden_field :humanizer_question_id %>
30
+
31
+ 3. If you are using attr_accessible, remember to whitelist `:humanizer_answer` and `:humanizer_question_id`.
30
32
 
31
33
  ## Configuration
32
34
 
@@ -36,8 +38,15 @@ You might want to add/change question and answer pairs. This can be easily done
36
38
 
37
39
  ## Skipping validation
38
40
 
39
- Set the attribute 'real_human' to true on the object you want to skip the Humanizer validation. Handy for testing or console use.
41
+ You might want to skip the humanizer validations on your tests or rails console.
42
+
43
+ You can just have a simple attribute on your model and use it to bypass the validation. Here's an example:
44
+
45
+ attr_accessor :bypass_humanizer
46
+ require_human_on :create, :unless => :bypass_humanizer
40
47
 
48
+ Now when bypass_humanizer is true, validation will be skipped.
49
+
41
50
  ## Live sites
42
51
 
43
52
  * [ArcticStartup.com](http://arcticstartup.com/) - signup form
data/lib/humanizer.rb CHANGED
@@ -4,7 +4,7 @@ module Humanizer
4
4
  base.extend(ClassMethods)
5
5
  end
6
6
 
7
- attr_accessor :humanizer_answer, :real_human
7
+ attr_accessor :humanizer_answer
8
8
  attr_writer :humanizer_question_id
9
9
 
10
10
  def humanizer_question
@@ -37,8 +37,8 @@ module Humanizer
37
37
  module ClassMethods
38
38
 
39
39
  def require_human_on(validate_on, opts = {})
40
- validates :humanizer_check_answer, :presence => {:on => validate_on,
41
- :unless => proc {|obj| obj.real_human}}
40
+ opts[:on] = validate_on
41
+ validate :humanizer_check_answer, opts
42
42
  end
43
43
 
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Humanizer
2
- VERSION = "2.2.0"
2
+ VERSION = "2.3.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 2.2.0
9
+ version: 2.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Antti Akonniemi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-18 00:00:00 +02:00
18
+ date: 2010-12-01 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency