# Rails still trying to access table that has been renamed

**URL:** <https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987>\
**Category:** Rails\
**Created:** [January 22, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987 "2007-01-22T17:43:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chhenning](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chhenning](https://www.ruby-forum.com/u/chhenning)\
**Post date:** [January 22, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987/1 "2007-01-22T17:43:48Z")

</div>

Hi there, I’m quite new to ruby on rails. The version I’m running is  
1.2. I have created my database schema using the rails migrate  
facilities. I have many tables with plenty of columns. During the  
course of creating tables I needed to make changes to existing tables,  
like renaming a table to a different name. For example I renamed my  
“People” table to “Persons” .

I have created a scaffolding controller to Persons. But for whatever  
reason rails is still trying to access a table called People.

This is my error:  
Mysql::Error: #42S02Table ‘md\_development.people’ doesn’t exist: SHOW  
FIELDS FROM people

How is that possible?

Thanks ahead,  
Christian

---

<div class="post-metadata">

**Author:** ![chhenning](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chhenning](https://www.ruby-forum.com/u/chhenning)\
**Post date:** [January 22, 2007, 6:39pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987/2 "2007-01-22T18:39:05Z")

</div>

It has to do with Rails naming convention. To much of a newbe myself,  
to explain well. I know you are supposed to name your DB tables with  
the singular form of a word, and then refer to the table in the  
pluralized form.

So when you try to refer to the DB by Persons, Rails looks for a table  
called People. It has nothing to do with the renaming, except that you  
renamed the table in the plural. Change it back to People and  
everything will work fine.

Hope that helps - K.

---

<div class="post-metadata">

**Author:** ![chhenning](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chhenning](https://www.ruby-forum.com/u/chhenning)\
**Post date:** [January 22, 2007, 7:18pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987/3 "2007-01-22T19:18:13Z")

</div>

Thank you so much Kim. Yeah that was it. As I’m non-native english  
speaker I think it’s kind of easy to make that failure. A quick search  
on google revealed:

people - 1.280.000.000 hits  
persons - 221.000.000 hits

Guess Rails is right. 😉

Thanks again,  
Christian

---

<div class="post-metadata">

**Author:** ![chhenning](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chhenning](https://www.ruby-forum.com/u/chhenning)\
**Post date:** [January 22, 2007, 7:58pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987/4 "2007-01-22T19:58:21Z")

</div>

Thanks Rob, I changed it back to persons since i think it makes more  
sense in my application.

Christian

---

<div class="post-metadata">

**Author:** ![chhenning](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/bb73d2/32.png) [@chhenning](https://www.ruby-forum.com/u/chhenning)\
**Post date:** [January 22, 2007, 7:39pm UTC](https://www.ruby-forum.com/t/rails-still-trying-to-access-table-that-has-been-renamed/102987/5 "2007-01-22T19:39:17Z")

</div>

On Jan 22, 2007, at 1:16 PM, chhenning wrote:

> Thanks again,  
> Christian

Well, “persons” is grammatically correct when the number of  
individuals is countable. It is more correct to say that my car  
“seats 5 persons” than to say “seats 5 people”. However, you have a  
“crowd of people”, not a “crowd of persons”.

Depending on the usage, the plural of “person” can be either  
“persons” or “people”, but the Inflector in Rails will only use the  
more common “people”. As those who have models named in non-English  
languages continually discover, the Inflector isn’t perfect. Even  
for many “English” words derived from Latin, the standard rules  
“fail”. (I ran into “criterion”/“criteria” that Rails thought should  
be “criteria”/“criterias” or “criterium”/“criteria” on a previous  
project.)

If your application makes sense to speak of “persons”, then you need  
to declare that in your model:

class Person \< ActiveRecord::Base  
set\_table\_name “persons”  
end

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
