Skip to content

Instantly share code, notes, and snippets.

@moyashiki
Last active January 20, 2016 15:18
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 moyashiki/0d55f84396c0299ef5e9 to your computer and use it in GitHub Desktop.
Save moyashiki/0d55f84396c0299ef5e9 to your computer and use it in GitHub Desktop.
require 'active_record'
ActiveRecord::Base.configurations = YAML.load_file('./database.yml')
ActiveRecord::Base.establish_connection(:development)
class User << ActiveRecord::Base
end
development:
adapter: "sqlite"
database: "dev.db"
require './database.rb'
ActiveRecord::Migration.drop_table :users
ActiveRecord::Migration.create_table :users do |t|
t.string :username
t.integer :age
t.datetime :birthday
end
require 'sinatra'
require 'sinatra/reloader'
require './database.rb'
set :bind, '0.0.0.0'
get '/' do
users = User.all
slim :index
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment