I have been struggling for the past few hours thinking about which route I should go. I have a Notification model. Up until now I have used a notification_type column to ma
I know this is old, but after having come up with a solution I see potential answers which could use it everywhere! I recently forked a promising project to implement multiple table inheritance and class inheritance in Rails. I have spent a few days subjecting it to rapid development, fixes, commenting and documentation and have re-released it as CITIER Class Inheritance and Table Inheritance Embeddings for Rails.
I think it should allow you to do what you needed by simply constructing the models where Twitter, Email and SMS inherit from Notification. Then have the migration for Notifications only include common attributes, and the ones for the three subtypes include their unique attributes.
Or even define a function in the root Notification class and overload it in subclasses to return something different.
Consider giving it a look: https://github.com/PeterHamilton/citier
I am finding it so useful! I would (by the way) welcome any help for the community in issues and testing, code cleanup etc! I know this is something many people would appreciate.
Please make sure you update regularly however because like I said, it has been improving/evolving by the day.