Expose files from service through rails application

I have a rails application that generates open office files, and I have a service elsewhere that converts these open office files to Microsoft Office files. I would like to have a controller action that sends the open office file to the converter, and then serves the returned Microsoft Office file for the user. How can i do this?

-C

+1
source share
2 answers

Departure

send_file @file.path, :x_sendfile => true

in apidock .

This allows you to serve files from a rail-authenticated file system, but the actual file will go through your apache / lighttd module and will not bind the rails process.

Office MS, , , , , , .

class MyController < ApplicationController
  def get_new_document
    unless params[:file_path].nil? or params[:server_uri].nil?
      @new_document = Net::Http.get(params[:server_uri], params[:file_path])
      @new_document.save # save to filesystem
    end
  end
end
+3

x_sendfile , nginx, X-Accel-Redirect. :

http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/
0

All Articles