use asset pipeline for other image fetches

This commit is contained in:
drusepth 2021-10-01 00:44:47 -07:00
parent 4e9f20a1a8
commit c544f2290b
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ class PageCollection < ApplicationRecord
end
# If all else fails, fall back on default header
"card-headers/#{self.class.name.downcase.pluralize}.jpg"
ActionController::Base.helpers.asset_path("card-headers/#{self.class.name.downcase.pluralize}.jpg")
end
def first_public_image

View File

@ -10,7 +10,7 @@ class ContentPage < ApplicationRecord
self.authorizer_name = 'ContentPageAuthorizer'
def random_image_including_private(format: :small)
ImageUpload.where(content_type: self.page_type, content_id: self.id).sample.try(:src, format) || "/assets/card-headers/#{self.page_type.downcase.pluralize}.jpg"
ImageUpload.where(content_type: self.page_type, content_id: self.id).sample.try(:src, format) || ActionController::Base.helpers.asset_path("card-headers/#{self.page_type.downcase.pluralize}.jpg")
end
def icon