Read more

Downloading files from Ruby on Rails

Dominik Schöler
July 26, 2011Software engineer at makandra GmbH

To offer files for download, use send_file.

def download(file)
  send_file file.path, :disposition => 'attachment'
end
Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot

Note that a send_file replaces the default :render action.

Posted by Dominik Schöler to makandra dev (2011-07-26 20:19)