Skip to content

Instantly share code, notes, and snippets.

@zliang-min
Created January 27, 2010 15:04
Show Gist options
  • Save zliang-min/287907 to your computer and use it in GitHub Desktop.
Save zliang-min/287907 to your computer and use it in GitHub Desktop.
A sample of using sequel and sinatra together.
require 'yaml'
require 'sinatra/base'
require 'sequel_core'
class MyApp < Sinatra::Base
configure do
DB = Sequel.connect YAML.load(File.read(__FILE__).split("__END__\n")[-1])[ENV['RACK_ENV'] || 'production']
Sequel::Mysql.convert_tinyint_to_bool = false
end
# routes any anything else come below
end
__END__
---
development: &base
adapter: mysql
host: localhost
user: mysql-user # username is also acceptable
password: secret
port: 3363
#socket: /tmp/mysqld/mysqld.sck
encoding: utf8
compress: false
timeout: 300
auto_is_null: false
production:
<<: *base
host: another_host
user: puser
password: ******
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment