Re: Automatically validate polymorphic belongs_to type column
I normally add an inclusion validation anyway, so encouraging developers to document the associations (for those that don’t normally add a validation) is a nice win that has the potential to save a lot of developer time when searching for or attempting to memorize the associations.
If I were to write Rails from scratch I’d disallow `polymorphic: true`, requiring that an array of classes be passed. Double wins like this (less mystery, DRY validations) are important for developer productivity IMO.
One note: `%w[banana orange]` isn’t valid in this case (the names need to be capitalized). I’m not sure if Rails accepts strings in cases like this; I’ve always used symbols e.g. for `:class_name`.