Skip to content

Instantly share code, notes, and snippets.

@garrensmith
Created September 11, 2010 10:08
Show Gist options
  • Save garrensmith/575054 to your computer and use it in GitHub Desktop.
Save garrensmith/575054 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
require 'mongoid'
configure do
Mongoid.configure do |config|
name = "demo"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.slaves = [
Mongo::Connection.new(host, 27017, :slave_ok => true).db(name)
]
config.persist_in_safe_mode = false
end
end
get '/' do
person = Person.new(:first_name => "Ludwig", :last_name => "Beethoven")
person.save
"Hello, I am #{person.first_name} #{person.last_name}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment