Home
> Ruby on Rails > Pluralize table names – no thanks!
Pluralize table names – no thanks!
4 April, 2006
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!
Categories: Ruby on Rails
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.
Yeah that can be a pretty irritating feature. Easily turned off though so don’t let it put you off rails.
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….
Thousand blessing on you. After a few hours of trying to figure out what the problem was I found this tip.
Thank you for this information! A thousand curses on the person who thought plural table names was a good idea!
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.
plural table names are a convension for those who think about tables as a collection.
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.
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
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.
thank you very much