I read the documentation on how to do this, but in practice I have problems. In my application, I have two different databases, as described below in my database.yml file.
sqlite_test:
adapter: sqlite3
database: db/sqlite_test.sqlite3
table: plots
pool: 5
timeout: 5000
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: test
pool: 5
username: myname
password: mypassword
host: localhost
My application is a dynamic plotter that will display data in a (base) database, not knowing what is in the database or how it is structured. Both of these databases contain different data. I created the SQLite database in a separate Rails application.
The current application that I use is built into the MYSQL database that I am creating from the outside. I copied the SQLite database to the / db directory. Therefore, in my main model, when I say:
class Plot < ActiveRecord::Base
establish_connection :development
set_table_name "stock_test"
set_primary_key :id
Everything works perfectly and perfectly. However, when I change it to:
establish_connection :sqlite_test
set_table_name "plots"
Rails, :
>>ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
, , database.yml ?
, , .
class Plot < ActiveRecord::Base
establish_connection(:adapter => "sqlite3", :database => "db/sqlite_test.sqlite3", :pool => 5 )
, whats database.yml, , database.yml?
!