diff --git a/app/controllers/social_previews_controller.rb b/app/controllers/social_previews_controller.rb index b7107f482..676290a6b 100644 --- a/app/controllers/social_previews_controller.rb +++ b/app/controllers/social_previews_controller.rb @@ -40,7 +40,7 @@ class SocialPreviewsController < ApplicationController def comment @comment = Comment.find(params[:id]) - @tag_badges = Badge.where(id: Tag.where(name: @comment.commentable.decorate.cached_tag_list_array).pluck(:badge_id)) + @tag_badges = Badge.where(id: Tag.where(name: @comment.commentable&.decorate&.cached_tag_list_array).pluck(:badge_id)) set_respond end diff --git a/app/views/social_previews/comment.html.erb b/app/views/social_previews/comment.html.erb index 9fbee3f54..0460983ba 100644 --- a/app/views/social_previews/comment.html.erb +++ b/app/views/social_previews/comment.html.erb @@ -113,10 +113,10 @@ <% elsif @comment.title.size < 50 %> <% font_size = 8.3 %> <% else %> - <% font_size = 15 - ((((@comment.title).size**0.92) + 85) / 16) %> + <% font_size = 15 - (((@comment.title.size**0.92) + 85) / 16) %> <% end %>
-

re: <%= @comment.commentable.title %>

+

re: <%= @comment.commentable&.title %>

<%= @comment.title %>