Render :file - images not taken

Hi,

In one of my apps, app 1 I’m rendering html content that is generated
with another of my apps, app 2. This content generated in app2 is stored
in the public folder of app 1. It has to be stored there, it cannot be
requested by app 1 in real time. It is basically one index.html and
images and they live together in a single folder inside the public area
of app 1.

In app 1 I’m using <%= render :file => “path_to_location” %> in a view
and it goes ok more or less. But the problem is that the images are not
taken. The src attribute of all images is only the name since they live
in the same location as the index.html so when rendered the images are
not found.

I cannot write a route to fix this because the route wouldn’t receive
all the details to write the redirect properly.

I know I could write the right img src when generating the content but
I’d like to avoid that since then the images wouldn’t be found in app
2…

Any suggestions? Tried rendering as partial but didn’t even find the
partial outside the app level.

Cheers.

comopasta Gr wrote in post #1031209:

Hi,

In one of my apps, app 1 I’m rendering html content that is generated
with another of my apps, app 2. This content generated in app2 is stored
in the public folder of app 1. It has to be stored there, it cannot be
requested by app 1 in real time. It is basically one index.html and
images and they live together in a single folder inside the public area
of app 1.

In app 1 I’m using <%= render :file => “path_to_location” %> in a view
and it goes ok more or less. But the problem is that the images are not
taken. The src attribute of all images is only the name since they live
in the same location as the index.html so when rendered the images are
not found.

I fixed my problem by making a get request to the public folder in the
controller. I fix the src attribute of the images and then I do a render
:inline of the response body in the view.