From: Herve Saint-Amand Date: Mon, 2 Jan 2017 21:35:59 +0000 (+0000) Subject: Proper way to get path to small avatar X-Git-Tag: live~4213^2~29 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/ab9aaf7e97b60d3dd8bbbd9867953637c05c0083 Proper way to get path to small avatar Rather than performing perilous string substitution on paths, just use the built-in way to select the small version of the avatar image file. --- diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 873cfafc4..40a516a92 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -182,7 +182,7 @@ class Notifier < ActionMailer::Base def user_avatar_file_path(user) image = user.image if image.file? - return image.path.sub("/original/", "/small/") + return image.path(:small) else return Rails.root.join("app", "assets", "images", "users", "images", "small.png") end