# Database and singularity issues

**URL:** <https://www.ruby-forum.com/t/database-and-singularity-issues/157978>\
**Category:** Rails\
**Created:** [January 17, 2009, 7:59am UTC](https://www.ruby-forum.com/t/database-and-singularity-issues/157978 "2009-01-17T07:59:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![awhayes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@awhayes](https://www.ruby-forum.com/u/awhayes)\
**Post date:** [January 17, 2009, 7:59am UTC](https://www.ruby-forum.com/t/database-and-singularity-issues/157978/1 "2009-01-17T07:59:44Z")

</div>

I’m writing my first rails app and following a tutorial to guide me. I  
really like what I see until… I get to the part where it tells me I  
have to follow a certain naming scheme for my database. Here’s my  
questions:

1. Do I HAVE to use plural table names?

I’ve been designing databases for years. I understand the logic for  
wanting to use plural names, but feel that singular names make more  
sense and as such have been designing my databases that way for years.  
Is there a workaround?

1. Do I HAVE to use the id naming standard.

It seems I was taught to name foreign keys with an FK\_TableName. Well,  
I hate using underscores in column names. Also, the FK is lame. The  
naming scheme I use gives each table an primary key named “id”. Any  
foreign keys are simply the name of the table which they represent.  
(Another reason why I wouldn’t want to use plural names). Is there a  
way to implement this in Rails?

1. Assuming that there are workarounds for these, are they  
stable/feasible or would they be a constant nuisance? Am I better off  
to go with the Rails standards?

I appreciate your thoughts.

---

<div class="post-metadata">

**Author:** ![awhayes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/73ab20/32.png) [@awhayes](https://www.ruby-forum.com/u/awhayes)\
**Post date:** [January 17, 2009, 12:18pm UTC](https://www.ruby-forum.com/t/database-and-singularity-issues/157978/2 "2009-01-17T12:18:16Z")

</div>

On 17 Jan 2009, at 06:59, Alan Harwood wrote:

> wanting to use plural names, but feel that singular names make more  
> sense and as such have been designing my databases that way for years.  
> Is there a workaround?

You can set pluralize\_table\_names on classes (or on ActiveRecord::Base)

> way to implement this in Rails?

For foreign keys you can call them whatever you want, but you’ll have  
to pass :foreign\_key =\> ‘blah’ to all your associations  
If you end up with the association having the same name as the column,  
i.e.

belongs\_to :person, :foreign\_key =\> ‘person’

Then you’re definitely skating on thin ice (because the association  
accessor methods will overwrite the attribute methods and stuff like  
that).

> 1. Assuming that there are workarounds for these, are they  
> stable/feasible or would they be a constant nuisance? Am I better off  
> to go with the Rails standards?

Most things can be made to work. I personally wouldn’t choose to fight  
Rails unless I had to (ie legacy database out of my control)

Fred
