Wednesday, January 09, 2013

Configuring Moonshine to use Apache XSendFile for Rails 3.2


1. rails plugin install git://github.com/railsmachine/moonshine_xsendfile.git
2. In the Moonshine manifest file:
    configure :xsendfile => {:x_send_file_path => '/absolute/path/to/download/url'}
    recipe :xsendfile
   
    This will work even if you have subdirectories under the /are directory.
3. In production.rb, uncomment the line:
    config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache

4. In your controller:
      send_file '/absolute/path/to/download/url/file.pdf', type: 'application/pdf'