Method: MongoidExt::File#get

Defined in:
lib/mongoid_ext/file.rb

#getObject



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mongoid_ext/file.rb', line 54

def get
  @io ||= begin
    io = nil
    begin
      io = gridfs.get(grid_filename)
      def io.read
        self.data
      end
    rescue Mongoid::Errors::DocumentNotFound => e
    end
    io
  end
end