ruby on rails - What happened to Mongoid.config.master.connection.host? -
i trying carrierwave (0.5.1) work mongoid (2.0.0.beta.20), rails 3. followed every step @ this guide.
in config/initializers/carrierwave.rb, have:
carrierwave.configure |config| config.grid_fs_database = mongoid.database.name config.grid_fs_host = mongoid.config.master.connection.host config.storage = :grid_fs config.grid_fs_access_url = "/uploads" end when try start server (rails server). in console, get:
...config/initializers/carrierwave.rb:3:in `block in <top (required)>': undefined method `host' #<mongo::connection: 0x00000103802420> (nomethoderror) i don't understand why getting error. i've looked everywhere , can't seem locate why happening...
it seems, mongoid.config.master.connection.host doesn't work anymore in newer versions of mongoid. removed? replacement this?
so far workaround following code:
carrierwave.configure |config| config.grid_fs_database = mongoid.database.name config.grid_fs_host = 'localhost' config.storage = :grid_fs config.grid_fs_access_url = "/uploads" end line 3, should be: config.grid_fs_host = 'localhost'. <-- there better way dynamically indicate host depending on environment?
found out mongo gem has changed. has be:
config.grid_fs_host = mongoid.database.connection.primary_pool.host
Comments
Post a Comment