Module: Mongoid::GridFSHelper

Defined in:
lib/mongoid-grid_fs.rb

Instance Method Summary collapse

Instance Method Details

#grid_fs_render(grid_fs_file, options = {}) ⇒ Object



591
592
593
594
595
596
597
598
599
600
# File 'lib/mongoid-grid_fs.rb', line 591

def grid_fs_render(grid_fs_file, options = {})
  options.to_options!

  if options[:inline] == false or options[:attachment] == true
    headers['Content-Disposition'] = "attachment; filename=#{ grid_fs_file.filename }"
  end

  self.content_type = grid_fs_file.content_type
  self.response_body = grid_fs_file
end