简体   繁体   English

将应用程序部署到Rails上的生产之后,我们可以连接到多个数据库连接吗?

[英]Can we connect to multiple database connections after the Application has been deployed to production on Rails?

I am new to Rails and need some help on this! 我是Rails的新手,需要一些帮助! Can we connect to a local database and production database simultaneously after the project has been deployed to production ?? 在项目部署到生产环境之后,我们能否同时连接到本地数据库和生产数据库?

for example : My application when deployed to production, with a click of a button on the page, it should toggle between the usage of production database and the user's local database.Is that possible ? 例如:我的应用程序部署到生产环境时,单击页面上的一个按钮,它应该在生产数据库的使用和用户的本地数据库之间切换。

Thanks! 谢谢!

You can do this, there are some clues in the comments here: 您可以执行此操作,这里的注释中有一些线索:

And a more comprehensive guide here: 还有更全面的指南:

But it's a bit of a faff - why do you need to do this, maybe there is another way to achieve what you want? 但这有点麻烦-为什么您需要这样做,也许还有另一种方法可以实现您想要的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM