diff options
Diffstat (limited to 'app/controllers/comments_controller.rb')
-rw-r--r-- | app/controllers/comments_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 2f3117f..9fa05e4 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb | |||
@@ -6,6 +6,9 @@ class CommentsController < ApplicationController | |||
6 | raise ActiveRecord::RecordNotFound unless @blog.published | 6 | raise ActiveRecord::RecordNotFound unless @blog.published |
7 | 7 | ||
8 | @comment = @blog.comments.new(comment_params) | 8 | @comment = @blog.comments.new(comment_params) |
9 | @comment.request_ip = request.ip | ||
10 | @comment.user_agent = request.user_agent | ||
11 | @comment.referrer = request.referrer | ||
9 | 12 | ||
10 | unless @comment.valid? | 13 | unless @comment.valid? |
11 | flash.alert = "Error posting comment." | 14 | flash.alert = "Error posting comment." |
@@ -23,11 +26,11 @@ class CommentsController < ApplicationController | |||
23 | author_url: @comment.website, | 26 | author_url: @comment.website, |
24 | post_url: url_for(@comment.blog), | 27 | post_url: url_for(@comment.blog), |
25 | post_modified_at: @comment.blog.updated_at, | 28 | post_modified_at: @comment.blog.updated_at, |
26 | referrer: request.referrer, | 29 | referrer: @comment.referrer, |
27 | env: request.env.slice(*akismet_vars) | 30 | env: request.env.slice(*akismet_vars) |
28 | } | 31 | } |
29 | 32 | ||
30 | is_spam, is_blatant = Akismet.check(request.ip, request.user_agent, akismet_params) | 33 | is_spam, is_blatant = Akismet.check(@comment.ip, @comment.user_agent, akismet_params) |
31 | 34 | ||
32 | if is_blatant | 35 | if is_blatant |
33 | # I am lying. | 36 | # I am lying. |