I\'m currently trying to send multiple files outside of my application using Rails send_file method. It loops through all of the files, but only sends the last one in the di
You can only send a single file in a single request; if you want to send multiple files you need to zip them up or otherwise bundle them.
send_file
tells the controller that it should respond to the browser's request by sending a file. -- As opposed to rendering a view, sending JSON, etc.
In common usage, you send exactly one response in HTTP. (I'm omitting discussion of long-polling and other esoteric types of responses. I'm also omitting HTTP multipart responses which are not generally supported at this time.)
Since you can only send one file, make it count! The one file can be a zip of a number of files, but then the user will need to unzip them.
An alternative is to show multiple download links on the web page, inviting the user to download one after another to accomplish the multiple downloads.
As an example UX (User Experience): Send an email to yourself with multiple attachments. Then use GMail and see how they present the multiple files for you to download.