|
You are here |
blog.jak-linux.org | ||
| | | | |
neilzone.co.uk
|
|
| | | | | Neil Brown's personal blog. | |
| | | | |
tenderlovemaking.com
|
|
| | | | | File.open('somefile.txt', 'wb') do |fh| # Open the file fh.write "hello world" # Do some work with the file end # Close file when block returns ActiveRecord::Base.establish_connection( :adapter => "sqlite", :database => "path/to/dbfile") connection_handle = ActiveRecord::Base.connection def retrieve_connection_pool(klass) pool = @connection_pools[klass.name] return pool if pool return nil if ActiveRecord::Base == klass retrieve_connection_pool klass.superclass end spec = ActiveRecord::Base.specificiation ActiveRecord::ConnectionPool.open(spec) do |conn| ... end spec = database_a ActiveRecord::ConnectionPool.open(spec) do |conn| User.find_all end spec = database_b ActiveRecord::ConnectionPool.open(spec) do |conn| User.find_all end # Retrieve the connection as... | |
| | | | |
sylvaindurand.org
|
|
| | | | | ||
| | | | |
blog.miguelgrinberg.com
|
|
| | | miguelgrinberg.com | ||