Reputation: 95
I'm working on a Ruby on Rails project where I have a "post" model and a "reply" model. As their names suggest, they share a lot of common properties such as "author_id" and "body", but have their own respective unique properties as well (e.g. a post has a title, whereas a reply does not).
My question is: what's the best practice for dealing with two similar data models? Right now I'm treating them as two distinct models types, but as I start coding, I realized there will be a lot of repetition of code.
Upvotes: 1
Views: 453