Pluralize table names – no thanks!
Sorry I just can’t live with plural table names, I just can’t get my head around it! Luckily it is easily turned off. In RadRails there is a simple tick box when creating the project which simply adds the following line to the end of your applications config/environment.rb file:
# Include your application configuration below ActiveRecord::Base.pluralize_table_names = false
I may live to regret not embracing plural table names but I doubt it!
Right-on. Not only is it just a dumb idea (why would you want to make your framework parse english?), most DBA’s will agree that the name of a table should refer directly to what one record in that table represents.
Thanks for letting me know how to turn off this stupid feature.
george coller
25 May 06 at 12:55 am
Yeah that can be a pretty irritating feature. Easily turned off though so don’t let it put you off rails.
justinram
25 May 06 at 1:13 pm
yup thanks a lot. i was cursing because i have an existing schema. You know with names like TLC_ACR_ONYM_TABLE_WTF and it was hard enough as it was to ‘guess’ what model name would be generated….
seth
18 Jun 06 at 9:43 pm
Thousand blessing on you. After a few hours of trying to figure out what the problem was I found this tip.
cutter
19 Jun 06 at 10:03 pm
Thank you for this information! A thousand curses on the person who thought plural table names was a good idea!
Michael
28 Nov 06 at 2:56 am
plural table names are just about ok, if that was all there was to it. but are the controllers plural too? the classes? maybe the views? maybe a random 50% of them. use a plural when generating scaffolds? it always seems 50:50 and such a waste of cycles to have to think about all the time.
dc
12 Feb 07 at 9:36 pm
plural table names are a convension for those who think about tables as a collection.
Keybern
31 Mar 07 at 5:56 pm
Unfortunately the simple tick box does nothing except generate an error message stating that it cannot find config/environment.rb even though it exists ….
Maybe it also had to do with the fact that I needed a symbolic link on my mac from /opt/local/bin/ruby to ruby.exe!!!! for radrails to do anything.
Thanks for the code above though, I’ll add it manually.
Alwyn
5 May 07 at 12:55 pm
thanks for the information.
it really helps
like seth, i also work with existing tables in oracle.
it’s irritating when error “table are not exist” comes out
eryna82
18 Mar 08 at 8:53 am
Thanks for the tip. I’m new to Rails and I’m glad I don’t have to start pluralizing everything. I did find, unfortunately, that this option is not honored correctly by the new scaffold generator in Rails 2.0.2. It created an index view that references (plural) @things, which is nil because the corresponding controller’s index method creates a (singular) @thing variable. Oh well.
Chris
30 Mar 08 at 4:42 am
thank you very much
Anonymous
3 Dec 08 at 11:39 am