File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ def create
25
25
@comment . user_email = current_user . email
26
26
@comment . user_agent = request . user_agent
27
27
@comment . user_ip = request . remote_ip
28
- @comment . request_format = request . format
28
+ @comment . request_format = request . format . to_s
29
29
30
30
if @comment . save
31
31
record_event ( 'created comment' )
32
- format . html { redirect_to protip_path ( @comment . commentable . try ( :public_id ) ) }
32
+ format . html { redirect_to protip_path ( @comment . commentable ) }
33
33
format . json { render json : @comment , status : :created , location : @comment }
34
34
else
35
- format . html { redirect_to protip_path ( @comment . commentable . try ( :public_id ) ) , error : "could not add your comment. try again" }
35
+ format . html { redirect_to protip_path ( @comment . commentable ) , error : "could not add your comment. try again" }
36
36
format . json { render json : @comment . errors , status : :unprocessable_entity }
37
37
end
38
38
end
Original file line number Diff line number Diff line change @@ -33,12 +33,12 @@ class Comment < ActiveRecord::Base
33
33
alias_method :author , :user
34
34
alias_attribute :body , :comment
35
35
36
- rakismet_attrs author : -> { self . user_name } ,
37
- author_email : -> { self . user_email } ,
38
- content : :comment ,
39
- blog : ENV [ 'AKISMET_URL' ] ,
40
- user_ip : -> { self . remote_ip } ,
41
- user_agent : -> { self . user_agent }
36
+ rakismet_attrs author : : user_name,
37
+ author_email : :user_email ,
38
+ content : :comment ,
39
+ blog : ENV [ 'AKISMET_URL' ] ,
40
+ user_ip : :remote_ip ,
41
+ user_agent : :user_agent
42
42
43
43
validates :comment , length : { minimum : 2 }
44
44
You can’t perform that action at this time.
0 commit comments