README.md in qu-mongoid-0.2.0 vs README.md in qu-mongoid-0.2.1

- old
+ new

@@ -5,12 +5,14 @@ ## Installation Add this line to your application's Gemfile: - gem 'qu' - gem 'qu-mongoid' +```ruby +gem 'qu' +gem 'qu-mongoid' +``` And then execute: $ bundle @@ -24,14 +26,22 @@ Mongoid version 2 and below uses the mongo driver, so use qu-mongo if you are on Mongoid 2. ## Configuration -Qu-Mongoid will automatically connect to the default session configured in mongoid.yml. If a default session is not configured, it will attempt to read from ENV['MONGOHQ_URL'] and ENV['MONGOLAB_URI'], so it should work on Heroku. If you need to use a different Mongoid connection, you can do the following: +Qu-Mongoid will automatically connect to the default session configured in mongoid.yml. If a default session is not configured, it will attempt to read from ```ENV['MONGOHQ_URL']``` and ```ENV['MONGOLAB_URI']```, so it should work on Heroku. If you need to use a different Mongoid session, you should do the following: +```ruby +Qu.configure do |c| + c.backend.session = :qu +end +``` + +You may also configure the Qu connection using the code below, but **WARNING**: if you are running your workers in threads, this configuration is **NOT** recommended. This is because Mongoid uses a separate connection on each thread, so only the original thread will use the configured connection. New threads will use the default Mongoid session as described above. + ``` ruby Qu.configure do |c| - c.connection = Mongoid::Sessions.with_name(:qu) + c.connection = Mongoid::Sessions.with_name(:qu) # New threads will not use this configured connection. end ``` ## Contributing