Created
March 21, 2014 17:57
-
-
Save joevandyk/9691869 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
require 'active_record' | |
DB = Sequel.connect('postgres://localhost/tanga_dev') | |
puts DB[:users].count | |
ActiveRecord::Base.connection.instance_variable_set(:@connection, DB.synchronize{|c| c}) | |
puts ActiveRecord::Base.connection.select_one('select count(*) from users') | |
# results in | |
10 | |
/usr/local/stow/ruby-2.1.1-gh-2014.3.18/lib/ruby/gems/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) | |
from /usr/local/stow/ruby-2.1.1-gh-2014.3.18/lib/ruby/gems/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_handling.rb:79:in `retrieve_connection' | |
from /usr/local/stow/ruby-2.1.1-gh-2014.3.18/lib/ruby/gems/2.1.0/gems/activerecord-4.0.4/lib/active_record/connection_handling.rb:53:in `connection' | |
from /tmp/t.rb:7:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment