Created
October 7, 2011 02:24
-
-
Save mindscratch/1269292 to your computer and use it in GitHub Desktop.
Mongoid and Qu configuration using MongoDB URI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this is only a partial YAML file from a Rails application | |
| # this YAML file would be loaded and used with the settingslogic gem | |
| defaults: &defaults | |
| database: &database | |
| conn_uri: mongodb://username:password@localhost:27001/ | |
| db_name: myapp_default | |
| job_queue: &job_queue | |
| db_name: qu | |
| development: | |
| <<: *defaults | |
| database: | |
| <<: *database | |
| db_name: myapp_development | |
| job_queue: | |
| <<: *job_queue | |
| db_name: qu_development | |
| test: | |
| <<: *defaults | |
| database: | |
| <<: *database | |
| db_name: myapp_test | |
| job_queue: | |
| <<: *job_queue | |
| db_name: qu_test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add this file to config/initializers in Rails | |
| # | |
| # mongoid 2.x.x | |
| # mongo (1.3.x or 1.4.x) | |
| Mongoid.configure do |config| | |
| uri = Settings.database.conn_uri + Settings.job_queue.db_name | |
| Mongoid::Config.from_hash({"uri" => uri}) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # qu (0.1.x) | |
| Qu.configure do |c| | |
| uri = Settings.database.conn_uri + Settings.job_queue.db_name | |
| c.connection = Mongo::Connection.from_uri(uri).db(Settings.job_queue.db_name) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment