Forum: Ruby on Rails Problem with mysql connector adding "s" to the end of querri

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
856a2b56b33bb52b7fe818250a52c2fa?d=identicon&s=25 jackster (Guest)
on 2006-12-31 00:34
(Received via mailing list)
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
Eea7ad39737b0dbf3de38874e0a6c7d8?d=identicon&s=25 Justin Forder (Guest)
on 2006-12-31 09:13
(Received via mailing list)
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 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
This topic is locked and can not be replied to.