Skip to content


feature: more options for gridfs #30

rand99 opened this Issue · 2 comments

2 participants



there s a new api for the current gridfs ruby driver (latest mongoid uses it)

and there are more options that can be set for storing the files.


# Saving IO data
file ="me.jpg")
id2  = @grid.put(file, 
         :filename     => "my-avatar.jpg" 
         :content_type => "application/jpg", 
         :_id          => 'a-unique-id-to-use-in-lieu-of-a-random-one',
         :chunk_size   => 100 * 1024,
         :metadata     => {'description' => "taken after a game of ultimate"})


id2   = @grid.put(image, "my-avatar.jpg", :safe => true) 

currently with latest mongoid i wasnt able to access the content-type
i had to save it manually to my model which includes the uploader

It would be great if we could define these options somewhere and that content-type works again.

best regards

CarrierWave member

(I fixed the code formatting in the original issue)

Could you please elaborate on this a bit more? CW-Mongoid already uses the :content_type option when saving the file to GridFS.

CarrierWave member

Closing this issue out. Please feel free to re-open with a failing test or pull-request.

@rmm5t rmm5t closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.