# Using Rails Scaffold command does not preserve Case on Table Name

**URL:** <https://www.ruby-forum.com/t/using-rails-scaffold-command-does-not-preserve-case-on-table-name/163986>\
**Category:** Rails\
**Created:** [March 26, 2009, 5:55pm UTC](https://www.ruby-forum.com/t/using-rails-scaffold-command-does-not-preserve-case-on-table-name/163986 "2009-03-26T17:55:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eengnerd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@eengnerd](https://www.ruby-forum.com/u/eengnerd)\
**Post date:** [March 26, 2009, 5:55pm UTC](https://www.ruby-forum.com/t/using-rails-scaffold-command-does-not-preserve-case-on-table-name/163986/1 "2009-03-26T17:55:13Z")

</div>

The following command issued at the terminal prompt for a Rails  
project should create a PostGreSQL table with the actual Table Name of  
Customers, but instead it creates a Table Name of customers. This is  
extremely disconcerting to me. Especially when I discovered that  
after using single quote marks (in the hope of remedying this), the  
command could not succeed in creating the other “serialization table”  
for tracking the autoincrementing id field.

The command in question:

ruby script/generate scaffold Customer LegalName:string Address:string  
City:string State:string PostalCode:string

The real surprise was that the field name cases were actually  
preserved! But not the Table Name. I don’t know why, but apparently  
there are a lot of programmers who think that “case does not matter”  
where table names are concerned. But they matter a Great Deal to  
me…ok?

---

<div class="post-metadata">

**Author:** ![eengnerd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/2acd7d/32.png) [@eengnerd](https://www.ruby-forum.com/u/eengnerd)\
**Post date:** [March 26, 2009, 6:37pm UTC](https://www.ruby-forum.com/t/using-rails-scaffold-command-does-not-preserve-case-on-table-name/163986/2 "2009-03-26T18:37:01Z")

</div>

On 26 Mar., 17:54, eengnerd [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ruby script/generate scaffold Customer LegalName:string Address:string  
> City:string State:string PostalCode:string
> 
> The real surprise was that the field name cases were actually  
> preserved! But not the Table Name. I don’t know why, but apparently  
> there are a lot of programmers who think that “case does not matter”  
> where table names are concerned. But they matter a Great Deal to  
> me…ok?

In Rails there is a set of naming conventions you need to use, in  
order to make the development process of your Rails application  
painless. Tables are plural nouns in snake case. Models are singular  
nouns in camel case. These two conventions were made to enable Rails  
to automatically detect the name of a table, based on the name of a  
model.

RacingCar model =\> racing\_cars table.

This kind of strict conventions does not exist for column names,  
because Rails doesn’t have to link them up to something else. Even  
though, it’s recommended to name your columns with snake case. If you  
really, really want to get around this, you can go to the migration  
file that the scaffold generator created for you and edit the table’s  
name manually and then, in your model, add this line:

set\_table\_name “Customers”

(But I hope you’ll learn to accept the naming conventions of Rails,  
soon.)

–  
Best regards,  
David K.  
[http://twitter.com/rubyguy](http://twitter.com/rubyguy)
