jackster
2006-Dec-20 01:33 UTC
Problem with mysql connector adding "s" to the end of querries
I am a beginner with ruby and was working through some basic examples from Onlamp where I create a basic controller and model, use the scaffold command, and edit my database.yml file to point it to the correct database. The problem I am having is that no matter what I do, I continue to get a mysql db connection error when I web to application. It seems that my connector is trying to connect to "infos" instead of "info". I deleted everything and started fresh, using other file names and it does the same thing; tries to connect to the "tests" table instead of the "test" table in my DB. As a cheezy workaround, I created a table in my DB called "infos" and created my controller and model named "info" and everything works since it automatically adds the "s" to the table name. Can anyone please point me in the right direction my obvious misconfiguration? thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Forder
2006-Dec-31 08:12 UTC
Re: Problem with mysql connector adding "s" to the end of querries
jackster wrote:> > I am a beginner with ruby and was working through some basic examples > from Onlamp where I create a basic controller and model, use the > scaffold command, and edit my database.yml file to point it to the > correct database. > > The problem I am having is that no matter what I do, I continue to get > a mysql db connection error when I web to application. It seems that my > connector is trying to connect to "infos" instead of "info". > > I deleted everything and started fresh, using other file names and it > does the same thing; tries to connect to the "tests" table instead of > the "test" table in my DB. > > As a cheezy workaround, I created a table in my DB called "infos" and > created my controller and model named "info" and everything works since > it automatically adds the "s" to the table name. > > Can anyone please point me in the right direction my obvious > misconfiguration?Sorry for the late reply - it has taken ten days for Google Groups to deliver your message. You haven''t any misconfiguration: unless you tell it not to, Rails expects table names to be plural, and class names to be singular. Look again at the ONLamp articles - you should find that they follow this pattern. regards Justin Forder --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---