Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rubygems"
- require "bundler/setup" #using bundler for dependencies
- #echo_with_ar.rb
- require 'goliath'
- require 'active_record'
- class User < ActiveRecord::Base
- end
- class EchoWithAr < Goliath::API
- use Goliath::Rack::Params
- use Goliath::Rack::DefaultMimeType
- use Goliath::Rack::Render, 'json'
- def response(env)
- #user = User.find(1).to_json
- User.connection.execute("SELECT sleep(1.0)")
- ActiveRecord::Base.clear_active_connections!
- [200, {}, "slept"]
- end
- end
- #config/echo_with_ar.rb
- require 'em-synchrony/activerecord'
- ActiveRecord::Base.establish_connection(:adapter => 'em_mysql2',
- :database => 'goliath_app',
- :username => 'root',
- :password => '',
- :reconnect => true,
- :pool => 10,
- :wait_timeout => 0.5,
- :host => 'localhost')
Add Comment
Please, Sign In to add comment