How to programmatically get the current database Mongoid is writing to?

前端 未结 5 1683
南笙
南笙 2021-02-13 15:22

I am talking to multiple databases using Mongoid.override_database(\"database_name\") using Mongoid with rails. How do I find the current database programmatically?

Mon

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-13 16:14

    If you want the overrided database you actually need to use

    Mongoid::Threaded.database_override
    

提交回复
热议问题