I am using Neo4j.rb in my rails app. I am having trouble with polymorphism.
I have something like this I have a Users class which looks like this:
class User
include Neo4j::ActiveNode
#other properties
has_many: out, :social_media_content, model_class: :SocialMediaContent
end
I have the SocialMediaContent class
class SocialMediaContent
include Neo4j::ActiveNode # Is it necessary?
property :first_name, type: Integer
property :first_name, type: Integer
end
I want to have an image class and a video class which inherit from Social media content
Does this mean that while creating a relationship between SocialMediaContent and a User i can provide an image or a video object instead of SocialMediaContent, How does it happen in the database, do i need to have a node for the image as well or can it be an ordinary object.
i.e
class Image < SocialMediaContent
include Neo4j::ActiveNode #Do i have to do this?
I want a behaviour like this: every User has many SocialMediaContent which can be either an image or a video (for now) i do not want to specify now, which one of them is an image and which is a video.
Can anyone suggest how i might acheieve this? And finally can i store an array of SocialMediaContent instead of has_many associations (which is better?)