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?
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
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.
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 Rob, I changed it back to persons since i think it makes more
sense in my application.
On Jan 22, 2007, at 1:16 PM, chhenning wrote:
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
If your application makes sense to speak of “persons”, then you need
to declare that in your model:
class Person < ActiveRecord::Base
Rob B. http://agileconsultingllc.com