This sets up a Sinatra service using a CouchDB instance on cloudant.com
To setup heroku:
Which will churn out your new Heroku web app location.
Create your database at cloudant.com. We'll call ours heyo_mountain.
I use the CouchRest gem and ostruct gem to setup the database in the Sinatra app. I keep mine in environmental.rb and call that in the app.rb:
require 'couchrest' require 'ostruct' configure do SiteConfig = OpenStruct.new( :url_base_db => 'https:/USERNAME:PASSWORD@USERNAME.cloudant.com/', :db_name => "heyo_mountain" ) end
- note that I used https:/ instead of the double whack because I can't figure out how to escape that from becoming a url :P Please change that to a //
and then in the model, assign the database, like so:
use_database CouchRest.database!((SiteConfig.url_base_db || '') + SiteConfig.db_name)