I'm trying to create a database schema diagram (a.k.a entity relationship diagram) of the PLOTS database using the data model in conjunction with the schema.rb file. I found a program online called dbdiagram.io program which allows you to upload schema.rb files to create these diagrams, and also export them as .sql files (which is nice if you'd prefer to use MySQL Workbench).
There are three things that I am seeking more information about regarding the PLOTS schema.rb and models file:
2a) Take, for example, the comment model. Does the image below reflect the accompanying code?
2b) How does the last line has_many :likes, :as => :likeable fit into the picture? There are functions in the model for liked_by, likers, emoji_likes, and user_reactions_map but how are the likes connected to the comments model?
class Comment < ApplicationRecord
include CommentsShared # common methods for comment-like models
belongs_to :node, foreign_key: 'nid', touch: true, counter_cache: true
# dependent: :destroy, counter_cache: true
belongs_to :user, foreign_key: 'uid'
belongs_to :answer, foreign_key: 'aid'
has_many :likes, :as => :likeable