0
@@ -30,12 +30,16 @@ model and a CommentsController:
0
- class Comment
Controller < ActionController::Base
0
+ class Comment
sController < ActionController::Base
0
-Rakismet sends the following information to the spam-hungry robots at Akismet,
0
-which means these attributes should be stored in your Comment model or
0
+Rakismet sends the following information to the spam-hungry robots at Akismet.
0
+This means these attributes should be stored in your Comment model or
0
accessible through that class's associations.
0
author : name submitted with the comment
0
@@ -52,35 +56,14 @@ accessible through that class's associations.
0
user_ip, user_agent, and referer are optional; you don't have to store them,
0
but it's a good idea. If you omit them from the Rakismet definition (see
0
-below), the +spam?+ method will look around in your request environment and
0
-find them there. This means that Rakismet is meant to be used in a synchronous
0
-fashion -- validating comments as they are submitted by the user, not placed
0
-in a queue for later spam-checking.
0
-If your attributes don't match those listed above, or if some of them live on
0
-other objects, you pass has_rakismet a hash mapping the default attributes to
0
-your own. You can change the names, if your comment attributes don't match the
0
- has_rakismet :author => :commenter_name,
0
- :author_email => :commenter_email
0
+"Customizing Attributes" below), the +spam?+ method will look around in your
0
+request environment and find them there. This means that Rakismet is meant to
0
+be used in a synchronous fashion -- validating comments as they are submitted
0
+by the user, not placed in a queue for later spam-checking.
0
-You can also pass in a proc, to access associations:
0
- has_rakismet :author => proc { author.name },
0
- :author_email => proc { author.email }
0
-For any attribute you don't explicitly define, Rakismet will try to find an
0
-attribute or method matching the default name. As mentioned above, you can
0
-either map user_ip, user_agent, and referer here or omit them and Rakismet
0
-will look for them in the request environment when you call +spam?+.
0
Rakismet provides three methods for interacting with Akismet:
0
@@ -102,4 +85,45 @@ a false positive. Likewise if they missed a spammy comment, @comment.spam!
0
will resubmit marked as spam.
0
+If your attribute names don't match those listed above, or if some of them
0
+live on other objects, you pass has_rakismet a hash mapping the default
0
+attributes to your own. You can change the names, if your comment attributes
0
+don't match the defaults:
0
+ class Comment < ActiveRecord::Base
0
+ has_rakismet :author => :commenter_name,
0
+ :author_email => :commenter_email
0
+Or you can pass in a proc, to access associations:
0
+ class Comment < ActiveRecord::Base
0
+ has_rakismet :author => proc { author.name },
0
+ :author_email => proc { author.email }
0
+For any attribute you don't specify, Rakismet will try to find an attribute or
0
+method matching the default name. As mentioned above, you can explicitly map
0
+user_ip, user_agent, and referer here or omit them. If you leave them out,
0
+Rakismet will look for them in the request environment when you call +spam?+.
0
+Most of the time you won't be checking for spam on every action defined in
0
+your controller. If you only call +spam?+ within CommentsController#create and
0
+you'd like to reduce filter overhead, has_rakismet takes :only and :except
0
+parameters that work like the standard before/around/after filter options.
0
+ class CommentsController < ActionController::Base
0
+ has_rakismet :only => :create
0
+==============================================================
0
Copyright (c) 2008 Josh French, released under the MIT license
Comments
No one has commented yet.