What does “imagery” mean in rails explaining polymorphic associations?

So, I'm trying to implement polymorphic association and view Rails Docs , but I'm confused about how they use "imageable." Is some kind of convention "figurative" or should it be attached to a table called "imageable"?

+4
source share
1 answer

imageable is an unwritten naming convention in polymorphic Rails associations.

Another example is taggable- which refers to an object that can be marked, i.e. taggable. Or for example, imageablean object having an attached image imageable, because it can receive an image.

In this case, you will have columns on the object belongs_to( Picture) called imageable_idand imageable_typestoring the identifier and model class of the associated object. You do not need a table imageable... only columns in the modelPicture

+7
source

Source: https://habr.com/ru/post/1541063/


All Articles