Class: Paperclipdb::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Paperclipdb::AttachmentsController
- Defined in:
- app/controllers/paperclipdb/attachments_controller.rb
Instance Method Summary collapse
Instance Method Details
#get_attachment ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/controllers/paperclipdb/attachments_controller.rb', line 3 def dir_name = '/' + params[:dir_name].join('/') base_name = params[:file_name] + '.' + params[:format] = Paperclipdb::Attachment.find(:first, :conditions => [ "base_name = ? AND dir_name = ?", base_name, dir_name ]) render :text => proc { |response, output| response.headers["Content-Type"] = .content_type output.write(.file_data) } end |