When we generate survey reports for clients, along with online reports with interactive graphs we also generate PDFs that clients can print out and share. Converting our online reports-each of which sometimes has several hundred graphs spread across multiple pages-to PDFs has been an interesting challenge.
We recently released a rails gem called ExternalFields (Github). As the name suggests, this gem allows you to create the illusion that an object has specific attributes when those attributes actually belong to an associated object. This is particularly useful for different classes within a single-table inheritance table to have access to separate fields in class-specific associations. In addition, this gem gives us more power than standard Ruby/Rails built-in delegation methods by automatically creating necessary objects and associating them.