]> git.openstreetmap.org Git - rails.git/blobdiff - app/mailers/user_mailer.rb
Use rails instead of rake
[rails.git] / app / mailers / user_mailer.rb
index 0664b8475ed866cc6244ac664ae76a45aa49cb60..33fcc7465a6fb8a056448032556dbf7c577b0b7c 100644 (file)
@@ -183,7 +183,7 @@ class UserMailer < ApplicationMailer
   end
 
   def attach_project_logo
-    attachments.inline["logo.png"] = File.read(Rails.root.join("app/assets/images/osm_logo_30.png"))
+    attachments.inline["logo.png"] = Rails.root.join("app/assets/images/osm_logo_30.png").read
   end
 
   def attach_user_avatar(user)
@@ -194,13 +194,12 @@ class UserMailer < ApplicationMailer
     avatar = user&.avatar
     if avatar&.attached?
       if avatar.variable?
-        image = avatar.variant(:resize => "50x50>").processed
-        image.service.download(image.key)
+        avatar.variant(:resize_to_limit => [50, 50]).download
       else
         avatar.blob.download
       end
     else
-      File.read(Rails.root.join("app/assets/images/avatar_small.png"))
+      Rails.root.join("app/assets/images/avatar_small.png").read
     end
   end