简体   繁体   English

在Rails中更改活动记录数据库

[英]Changing a Active Record DB in Rails

I have a rails app I created with based on a DB with a table named "countries", which stored a list of all the countries in the world. 我有一个基于数据库的Rails应用程序,该应用程序具有一个名为“ countries”的表,该表存储了世界上所有国家的列表。 Now I have found out that the actual DB I will be using uses a table named "ctry" instead (stupid I know). 现在,我发现我将使用的实际数据库使用的是名为“ ctry”的表(我知道这很愚蠢)。 What I am trying to figure out is if there is any way I can point active record to this new table without having to swap out every single instance in "countries" from the controller names, file names, etc. 我要弄清楚的是,是否有任何方法可以将活动记录指向此新表,而不必从控制器名称,文件名等中换出“国家”中的每个实例。

I'm not at all sure if this could possibly be done with routes or how someone might do it. 我完全不确定这是否可以通过路线完成或有人可以做到。

This is the active record model as it exists now: 这是现存的活动记录模型:

class countries < ActiveRecord::Base
end

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

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