File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ def create
2525 @comment . user_email = current_user . email
2626 @comment . user_agent = request . user_agent
2727 @comment . user_ip = request . remote_ip
28- @comment . request_format = request . format
28+ @comment . request_format = request . format . to_s
2929
3030 if @comment . save
3131 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 ) }
3333 format . json { render json : @comment , status : :created , location : @comment }
3434 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" }
3636 format . json { render json : @comment . errors , status : :unprocessable_entity }
3737 end
3838 end
Original file line number Diff line number Diff line change @@ -33,12 +33,12 @@ class Comment < ActiveRecord::Base
3333 alias_method :author , :user
3434 alias_attribute :body , :comment
3535
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
4242
4343 validates :comment , length : { minimum : 2 }
4444
You can’t perform that action at this time.
0 commit comments