@ -24,7 +24,7 @@ class PraiseTreadController < ApplicationController
end
return
end
#@horizontal = params[:horizontal].downcase == "false" ? false:true
@horizontal = params [ :horizontal ] . downcase == " false " ? false :true if params [ :horizontal ]
if @obj . respond_to? ( " author_id " )
author_id = @obj . author_id
elsif @obj . respond_to? ( " user_id " )
@ -127,6 +127,8 @@ class PraiseTreadController < ApplicationController
@obj = Comment . find_by_id ( id )
when 'Journal'
@obj = Journal . find_by_id ( id )
else
@obj = nil
end
return @obj
end
@ -143,7 +145,8 @@ class PraiseTreadController < ApplicationController
# end
#再创建或更新praise_tread_cache表
@ptc = PraiseTreadCache . find_by_object_id_and_object_type ( id , type )
#@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type)
@ptc = PraiseTreadCache . where ( " object_id = ? and object_type = ? " , id . to_i , type ) . first
@ptc = @ptc . nil? ? PraiseTreadCache . new : @ptc
@ptc . object_id = id . to_i
@ptc . object_type = type