From c4852b34868be83cf40e0a7f9345d2aba2a39580 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 1 Feb 2022 13:19:50 -0600 Subject: [PATCH] rails: fix deprecated #to_s(:format) method. Fix this deprecation: Deprecate passing a format to #to_s in favor of #to_formatted_s in Array, Range, Date, DateTime, Time, BigDecimal, Float and, Integer. https://guides.rubyonrails.org/7_0_release_notes.html#active-support-deprecations --- app/logical/discord_slash_command/post_embed.rb | 2 +- app/views/post_replacements/index.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/logical/discord_slash_command/post_embed.rb b/app/logical/discord_slash_command/post_embed.rb index 419b9ba96..ecd811467 100644 --- a/app/logical/discord_slash_command/post_embed.rb +++ b/app/logical/discord_slash_command/post_embed.rb @@ -52,7 +52,7 @@ class DiscordSlashCommand def embed_footer dimensions = "#{post.image_width}x#{post.image_height}" - file_size = post.file_size.to_s(:human_size, precision: 4) + file_size = post.file_size.to_formatted_s(:human_size, precision: 4) text = "#{post.fav_count} ❤ | Rating: #{post.rating.upcase} | #{dimensions} (#{file_size} #{post.file_ext})" { text: text } diff --git a/app/views/post_replacements/index.html.erb b/app/views/post_replacements/index.html.erb index 72ccd272f..67e7893a2 100644 --- a/app/views/post_replacements/index.html.erb +++ b/app/views/post_replacements/index.html.erb @@ -45,13 +45,13 @@
Original Size
<%= post_replacement.old_image_width %>x<%= post_replacement.old_image_height %> - (<%= post_replacement.old_file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.old_file_ext %>) + (<%= post_replacement.old_file_size.to_formatted_s(:human_size, precision: 4) %>, <%= post_replacement.old_file_ext %>)
Replacement Size
<%= post_replacement.image_width %>x<%= post_replacement.image_height %> - (<%= post_replacement.file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>) + (<%= post_replacement.file_size.to_formatted_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
<% end %>