Render file rails3

I am trying to make a png file in a controller in Rails3. I use:

render :file=>'public/images/filename.png'

However, the output does not seem to be a PNG file (its contents begin with “PNG” - checked with curl — but it is not a valid file). I can not find the rendering documentation: file in Rails3. Has the syntax changed for this? Even if this is a MIME type problem, I think I should get a swirl file.

I use this technique to display the default image when using Fleximage images, if available. Fleximage images work correctly, but this simple operation does not work.

+3
source share
1 answer

using:

send_file path_to_file
+4
source

Source: https://habr.com/ru/post/1758637/


All Articles