Rails STI & Polymorphic Association for Easier File Management
Gems like paperclip have made file uploads easy. But something as simple as attaching images to models can get messy and repetitive in a large application. By using a combination of single table inheritance and polymorphic association, we can build dry code and make it easier to manage files.