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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
chhenning
2007-Jan-22 18:16 UTC
Re: Rails still trying to access table that has been renamed
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn
2007-Jan-22 18:38 UTC
Re: Rails still trying to access table that has been renamed
On Jan 22, 2007, at 1:16 PM, chhenning wrote:> > 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, > ChristianWell, "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 Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
chhenning
2007-Jan-22 18:57 UTC
Re: Rails still trying to access table that has been renamed
Thanks Rob, I changed it back to persons since i think it makes more sense in my application. Christian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---