diff --git a/app/models/concerns/galleryable.rb b/app/models/concerns/galleryable.rb index 1063c5571..5ddf322f6 100644 --- a/app/models/concerns/galleryable.rb +++ b/app/models/concerns/galleryable.rb @@ -6,7 +6,7 @@ module Galleryable accepts_nested_attributes_for :images, allow_destroy: true, update_only: true def image_url(style) - image.attachment.url(style) if image && image.attachment.exists? + image&.attachment&.url(style) || "" end end -end \ No newline at end of file +end diff --git a/app/models/concerns/imageable.rb b/app/models/concerns/imageable.rb index 727ff9a6b..3e3b15685 100644 --- a/app/models/concerns/imageable.rb +++ b/app/models/concerns/imageable.rb @@ -6,7 +6,7 @@ module Imageable accepts_nested_attributes_for :image, allow_destroy: true, update_only: true def image_url(style) - image.attachment.url(style) if image && image.attachment.exists? + image&.attachment&.url(style) || "" end end end