我正在使用Rails4,Mongoid4和Gridfs。我; M無法連接GridFS的文件系統Monogid4 Gridfs連接失敗
class GridfsController < ApplicationController
def serve
gridfs_path = env["PATH_INFO"].gsub("/uploads/", "")
begin
gridfs_file = Mongo::GridFileSystem.new(Mongo::DB.new('database_name', Mongo::Connection.new('localhost'))).open(gridfs_path, 'r')
self.response_body = gridfs_file.read
self.content_type = gridfs_file.content_type
rescue Exception => e
self.status = :file_not_found
self.content_type = 'text/plain'
self.response_body = ''
raise e
end
end
end
得到這個錯誤
NameError(未初始化常數GridfsController ::蒙戈):
應用程序/控制器/ gridfs_controller.rb:7:在`服務」
它工作正常,非常感謝你 – sukendhar