I am trying to stream data stored on Amazon S3 to a client. Unfortunately, I am unable to redirect to the bucket with a presigned URL in order to support such files as HTML which require the original HTML file to be served from the same domain as its assets (css, etc..).
After reading http://apidock.com/rails/ActionController/Base/render
It seemed to me as though I should be able to do the following:
render :text => proc { |response, output|
s3_object.get(response_target: output)
end
However, the output of this on the page was just the result of proc.to_s
Similarly, the example provided in the Rails docs:
render :text => proc { |response, output|
100.times do |i|
output.write("This is line #{i}\n")
end
}
Seems to do the same.
Has anyone run into this problem? Is there a reason why Rails is not properly rendering the results of the lambda instead of calling .to_s?
Thanks.