[openstreetmap/openstreetmap-website] Dressed up notification mails (#1401)

Hervé Saint-Amand notifications at github.com
Mon Jan 2 22:27:56 UTC 2017


saintamh commented on this pull request.



>        mail :to => recipient.email, :subject => subject
     end
   end
 
   private
 
+  def user_avatar_file_path(user)
+    image = user.image
+    if image.file?
+      return image.path.sub("/original/", "/small/")
+    else
+      return Rails.root.join("app", "assets", "images", "users", "images", "small.png")
+    end
+  end
+

`image.path(:small)` works, thanks.

However `image_path("users/images/small.png")` returns `"/assets/users/images/small-19cb2e87cebaee3dbe77d1b540f68136dae6f8e63ec055907d19f639773101e2.png"`, which is the path part of a public URL. But I want something that I can `File.read`.

Would you find the above code less objectionable if I just concatenated it all into one string using slashes, e.g. `"#{Rails.root}/app/assets/images/users/images/small.png"` ? That seems more in line with what other parts of the code already do (for config files, though, not for asset files).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1401
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170102/c5af0b7e/attachment.html>


More information about the rails-dev mailing list