Skip to content

Instantly share code, notes, and snippets.

@durran
Created January 30, 2012 09:38
Show Gist options
  • Save durran/1703577 to your computer and use it in GitHub Desktop.
Save durran/1703577 to your computer and use it in GitHub Desktop.
Sample Mongoid multi-connection/db/collection persistence.
class Band
include Mongoid::Document
store_in collection: "artists", database: "musik", session: "primary"
end
Band.with(collection: "bands").create
Band.new.with(session: "secondary").save!
Band.where(name: "Depeche Mode").with(database: "legends")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment