about summary refs log tree commit diff
path: root/app/models/media_attachment.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-10-13 15:27:19 +0200
committerGitHub <noreply@github.com>2021-10-13 15:27:19 +0200
commit5159ba26e485daaeded2288c1b02bd1e516e1ca6 (patch)
tree409023bc5a521a321205265d9c1d8fd6d3eb3273 /app/models/media_attachment.rb
parent8818622feb9454684e51cd9b977b967883779432 (diff)
Fix error when rendering public pages with media attachments (#16763)
* Add tests

* Fix error when rendering public pages with media attachments

* Add tests

* Fix tests

* Please CodeClimate
Diffstat (limited to 'app/models/media_attachment.rb')
-rw-r--r--app/models/media_attachment.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index 97d619f35..1741d20e9 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -217,7 +217,7 @@ class MediaAttachment < ApplicationRecord
   end
 
   def to_param
-    shortcode
+    shortcode.presence || id&.to_s
   end
 
   def focus=(point)