5

I am new to rails, don't know how to access multiple databases in rails single application.

I will try like this

config/database.yml

default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password: root
  socket: /var/run/mysqld/mysqld.sock
  reconnect: true

development:
  <<: *default
  database: connection_development
<<: *default
  database: connection_test

second database

log_database_production:
  adapter: mysql2
  encoding: utf8
  pool: 5
  host: 192.168.100.97
  port: 3306        #ip address of server with other postgres database
  username: root
  password: root
  database: hrms_development
  reconnect: true

then i don't know how to proceed..

puneet18
  • 4,341
  • 2
  • 21
  • 27
Santosh Kumbhar
  • 183
  • 3
  • 15
  • Does this answer your question? [Connecting to multiple databases in ruby on rails](https://stackoverflow.com/questions/17311199/connecting-to-multiple-databases-in-ruby-on-rails) – markroxor May 29 '22 at 04:22

0 Answers0