Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

How can I get correct path of image (Production env) in Controller js (StimulusJs file) of Rails 7 app?

1
Rails

I am using event.target.innerHTML = <img src="/assets/Answer_${draggableElementBrand}.png"> to add element when a action is triggered. It works well in development but when I deploy it in Production, it's failed to load the image's path because the correct image's path is hashed. Do you have any idea or trick to get the correct path in this case? I am using Rails with ESbuild. Thank you so much.

SPAM comment reply, do not click the link

Join the discussion
Create an account Log in