@@ -4,7 +4,7 @@ class CommentsController < ApplicationController
44 before_action :authenticate_user! , except : [ :post , :show , :thread , :thread_content ]
55
66 before_action :set_comment , only : [ :update , :destroy , :undelete , :show ]
7- before_action :set_post , only : [ :create_thread ]
7+ before_action :set_post , only : [ :create_thread , :post_follow , :post_unfollow ]
88 before_action :set_thread ,
99 only : [ :create , :thread , :thread_content , :thread_rename , :thread_restrict , :thread_unrestrict ,
1010 :thread_followers ]
@@ -274,7 +274,6 @@ def post
274274 end
275275
276276 def post_follow
277- @post = Post . find ( params [ :post_id ] )
278277 if ThreadFollower . where ( post : @post , user : current_user ) . none?
279278 ThreadFollower . create ( post : @post , user : current_user )
280279 end
@@ -286,7 +285,6 @@ def post_follow
286285 end
287286
288287 def post_unfollow
289- @post = Post . find ( params [ :post_id ] )
290288 ThreadFollower . where ( post : @post , user : current_user ) . destroy_all
291289
292290 respond_to do |format |
@@ -308,7 +306,7 @@ def comment_params
308306 end
309307
310308 def set_comment
311- @comment = Comment . unscoped . find params [ :id ]
309+ @comment = Comment . unscoped . find ( params [ :id ] )
312310 end
313311
314312 def set_post
0 commit comments