Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

New mongoid #49

Closed
swistaczek opened this Issue · 6 comments

4 participants

Ernest Bursa Edson Hilios Niels V Ryan McGeary
Ernest Bursa

Hi,
I am trying to set carierwave with Mongoid but in new wersion Mongoid.database is undefined. What is new name of Mongoid.database method?

Edson Hilios

Now the Mongoid uses Moped for opening mongo sessions, there are new features that allow you to connect to multiple database at the same time, or even a cluster, so the object is more abstract than was before, and holds multiple host information.

Said that my best try in this issue is:

CarrierWave.configure do |config|
  config.grid_fs_database = Mongoid::Config.sessions[:default][:database]
  config.grid_fs_host     = Mongoid::Config.sessions[:default][:hosts].first
  config.storage :grid_fs
end

Let's see what the guys from carrierwave says about my conf. But hope that helps you.

Niels V

Mongoid 3 (or rather their mongodb driver, moped) does not support gridfs, see http://mongoid.org/en/mongoid/docs/upgrading.html

Ryan McGeary
Collaborator

@nvdk carrierwave-mongoid uses moped-gridfs via the mongoid-3.0 branch. For now, that looks like this in your Gemfile:

gem "carrierwave-mongoid", :git => "git://github.com/jnicklas/carrierwave-mongoid.git", :branch => "mongoid-3.0"
Niels V

Ah cool didn't know that, thanks :)

Edson Hilios

Thats great, guys! Thanks

Ryan McGeary
Collaborator

Triaging. Closing this out now that carrierwave-mongoid 0.3.0 is out. It supports Mongoid 3.0 and no longer needs the grid_fs_xxx config options.

Ryan McGeary 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.