Accessing a table whose name is singular

Hello list,

I'm new to ActiveRecord. Actually, I'm using it outside of a rails application (crazy I know). I have the following simple test code:

The database I'm connecting to maintains a User table -- note that the name of the table is singular. How can I connect to a table that has a name like User? ActiveRecord seems to append an 's' character and tries to connect to a Users table.

That is indeed the convention AR uses. You can use set_table_name to override that.



The syntax is

class User < ActiveRecord::Base   set_table_name 'user' end