Rails 6 app with ActiveStorage has a application helper that returns the profile image of a user.
module ApplicationHelper def profile_picture_with_class user, css_class, shape, width = 100 if (shape == :square) placeholder_pic = "blank_profile_square.jpg" else placeholder_pic = "blank_profile_round.png" end image_path = user.profile_image.present? ? user.profile_image : placeholder_pic image_tag(image_path, width: width, class: css_class) end end
When this applicationHelper is called from within the app it works fine. If however a redis job uses this applicationHelper the returned image_tag is going to instead of my apps actual host (localhost:3000 in dev) and this creates a very broken link.
I'm guessing since this is firing off inside a redis job it doesnt know what the host is so its prepending something else. How can I get it to understand to use the correct host and active storage type (disk vs blob)
Thanks.
Comparison of the two created links:
Example:
Redis returns this:
http://example.org/rails/active_storage/blobs/<big_long_chunk>/new-chimney-crown.jpg
When run within a view it returns this:
http://localhost:3000/rails/active_storage/disk/<big_long_chunk>/new-chimney-crown.jpg?content_type=image%2Fjpeg&disposition=inline%3B+filename%3D%22new-chimney-crown.jpg%22%3B+filename%2A%3DUTF-8%27%27new-chimney-crown.jpg