I am trying to make a messaging system in rails which will enable a user to send messages to a listing. Once they click on send message a new conversation is created between the user and and the listing. So a conversation is always between only 2 users.
here is basic setup
User has_many Listings
Listing belongs_to User
For adding private messaging system as described above I am planning like below
Conversation has_many Messages
Message belongs_to Conversation
listing has_many conversation
user has_many conversation
conversation belongs_to listing
conversation belongs_to user
I have never done something this crazy. I have a feeling that there is another better way to do this or am overkilling it. I know I easily create messaging if its between 2 users, but as a user can have many listings and I want a different conversation for each listing(so basically conversation is between a user and a listing) even its from the same owner. Could someone shed some light into which approach to go on schema design in this situation?