Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
调用 Table(*column_symbol*) 时,假设我们正在使用主数据库。
如何在第二个数据库中使用 arel 表,而不必为每个查询的表使用 ARModel?
table = Arel::Table.new("db_name.table_name")
对我来说很好。
在 config/database.yml 中指定您的“第二个数据库”参数
并在您的模型中,指定establish_connection :db_params
establish_connection :db_params