Problem with mysql connector adding "s" to the end of querri


#1

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


#2

jackster wrote:

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 G. 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 F.