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..

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.