News for hackers. Stuff that matters.
Re:Happy Birthday, Ruby by izietto on Thursday January 10, 2019 @09:47AM (#18874169)
"pluralizing words in your database migrations" is ispired by convention over configuration pattern, and comes from an age where there weren't almost any standard rules, even table names were some singular, some plurals, some ALL_UPCASED, some all_downcased, some MiXeD, some dash-erized, some camel_ized, ... I come from that age and it helped a lot.
Re:Happy Birthday, Ruby by cmrdporcupine on Thursday January 10, 2019 @10:06AM (#18874292)
I was taught singular table names back in the 90s, and as far as I remember it was the convention everywhere prior to Rails becoming endemic. And AFAIK it's what Codd and other relational luminaries mandated.
Re:Happy Birthday, Ruby by lowercased on Thursday January 10, 2019 @10:01AM (#18874259)
pluralization seems to be somewhat orthogonal to the "no standards" issue you raise; one could have introduced standard rules to help with that 'wild west' and still left out pluralization. pluralization brings with it runtime overhead and edge cases (which can be dealt with with more runtime overhead, of course).
Re:Happy Birthday, Ruby by calaveraDeluxe on Thursday January 10, 2019 @10:56AM (#18874741)
I'm curious, where does pluralization of table names bring runtime overhead? AFAIK, they are stored in the model and not generated every time they are needed.
Re:Happy Birthday, Ruby by lowercased on Friday January 11, 2019 @10:13AM (#18884035)
apparently, my bad. my earlier reading of rails from years ago was that this was runtime inflection, not at generation time.

it still, imo, adds some cognitive overhead, and other orms I've used (grails/gorm, for example), don't try to pluralize. you can pluralize by hand if you want to, but the default is just to name a table whatever the class name is.

Re:Happy Birthday, Ruby by dnautics on Thursday January 10, 2019 @12:53PM (#18876108)
It does bring cognitive overhead, when it's not explicit
Re:Happy Birthday, Ruby by Karunamon on Thursday January 10, 2019 @01:11PM (#18876306)
But you’re writing an ActiveRecord migration. It’s explicit in the same way that echoing a string out is ‘puts’ instead of ‘print’ because this is Ruby and not Python.
Re:Happy Birthday, Ruby by dnautics on Thursday January 10, 2019 @03:08PM (#18877568)
what if you're on a team where your responsibilities are divided and you only touch ActiveRecord sporadically?

What does ActiveRecord consider the plural of "fish"?

Re:Happy Birthday, Ruby by sethrin on Thursday January 10, 2019 @03:50PM (#18877999)
You can change the inflections if you need to do so. ActiveRecord by default considers fish to be an uncountable noun, so the plural would be "fish".