views:

48

answers:

1

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. Now I have found out that the actual DB I will be using uses a table named "ctry" instead (stupid I know). 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
+3  A: 
klochner
Thank you. You saved my sanity big time. I kept searching through the ROR api with no luck. This definitely helps. Thanks again
John Baker
If the database is only going to be used by your rails app going forward, you could also rename the table in MySQL:http://dev.mysql.com/doc/refman/5.0/en/rename-table.html
klochner
Further: You could also rename the table in a migration with "rename_table('ctry', 'countries')".
askegg
Thank you askegg, that was very helpful actually
John Baker