Monday 15 April 2013

ruby - Heroku: database configuration does not specify adapter -


I have an app that has that which uses postgresql as a database. I have created a new model that will connect to a remote message database like the following:

  # other_database.rb (apps / model /) class other database & lt; ActiveRecord :: Base self.abstract_class = true establ_connection "remote _ # {Rails.env}" end #other_model.rb (apps / model /) Category OtherModel & LT; Other databases self.table_name = "users" end   

I've edited the Detabeskaimel file and add these entries:

  remote_development: adapters: mysql2 encoding: Utf8 reconnect: false database: app_development pool: 5 username: root password: socket: /var/run/mysqld/mysqld.sock remote_production: adapter: mysql2 encoding: utf8 reconnect: the database: app_production pool: 40 Username: Root password: Secretpassword socket: /var/run/mysqld/mysqld.sock Host: 12.34.56.78   

Remote database mysql its database Uses as

This works fine in my local machine, but when I put it on my lock, it creates an error page, so I looked at her lock log, and I found out: < / p>

  / app / vendor / bundle / ruby ​​/2.0.0/gems/activerecord-4.0.0.beta1/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection ': database configuration adapter (ActiveRecord :: AdapterNotSpecified) does not specify the / app / vendor / b undle / ruby ​​/ 2.0.0 / gems / ActiveRecord-4.0.0.beta1 / lib / active_record / connection_adapters / connection_specif Ict.rb: 46: In `resolve_string_connection` I'm spending almost all my time is looking for some answers but no benefit is expected that anyone with this issue Can help.  

TIA

Aarlaf

deletes Hacquer and recreates the database. This means that whatever you put into your database.yml file will be completely ignored by Heroku

Pause your database credentials in your established_connection method call. installation_connection (adapter: 'MySkill 2', encoding: 'UTF8', reconnect: true, database: 'ap_production', pool: 40, username: 'root', password: ' secret password, socket: '/ var / run / mysqld / mysqld .sock', host: '12 .34.56.78 ')

However, it uses a database URL and Heroku It would be better to store in an environment variable

.  Horoku Config: Set MYSQL_DB_URL = http: //example.com/rest_of_the_url   

Then use

  install_connection (ENV [ 'MYSQL_DB_URL'] Do)   

Examples and documents for a URL can be found here:

No comments:

Post a Comment