Skip to content

Instantly share code, notes, and snippets.

@ihsw
Created February 22, 2016 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihsw/194d2c2faa764b97b80b to your computer and use it in GitHub Desktop.
Save ihsw/194d2c2faa764b97b80b to your computer and use it in GitHub Desktop.
require 'sinatra/base'
require 'json'
require 'active_record'
require_relative './default_routes'
require_relative './posts_routes'
host = 'db'
if ENV['ENV'] == 'travis'
host = 'localhost'
end
ActiveRecord::Base.establish_connection("postgres://postgres@#{host}/postgres")
class Post < ActiveRecord::Base
end
class Server < Sinatra::Base
use DefaultRoutes
use PostsRoutes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment