I'm trying to figure out what to call a polymorphic association, and not come up with good options. The class that will contain the polymorphic association is called LicenseBatch , and if it were not polymorphic, the foreign key would simply be owner_id . It seems that the go-to polymorphic name will be ownerable , but what if I have another class that is the owner? I would like it to be more specific, but things like batch_ownerable sound awkward.
LicenseBatch
owner_id
ownerable
batch_ownerable
Any suggestions or similar situations you've seen before?
Try putting a name that automatically references the model name, so if the model is a comment, I would use commentable_type and commentable_id. For this particular case, I would use:
licensable_batch_type and licensable_batch_id
Source: https://habr.com/ru/post/973725/More articles:Combine and run multiple R script s from another script - rCreate an instance of a derived class from the base class - inheritanceWhy is a singleton class hard to test? - javaSwift: use a wildcard as a type parameter - genericsWhy do I need to import a characteristic in order to use the methods that it defines for the type? - rustC # can you hide a legacy interface? - genericsAngularJS $ promises then () data undefined - javascriptCounting the number of substrings of 5 characters inside a string - pythonSQL combines COUNT and SUM in one query - sqlFaster string comparison in Ruby - ruby โโ| fooobar.comAll Articles