I'm creating a view that features a video stored via ActiveStorage. Currently I'm displaying the video like this:
%video{ controls: true, preload:"metadata" }
%source{ src: rails_blob_path(@video.source), type: "TODO: Content Type" }
I'd like to find a way to get the content type from the attachment. I've found that I can get to it by using @video.source.attachment.blob.content_type
but that seems so clunky. Is there another simpler way to go about it that resembles video.source.content_type
? Unfortunately using the video_tag
helper is not a viable solution for me.
def content_type; source.attachment.blob.content_type; end
and then you do@video.content_type
? – Hectoliter