Highlight changes being made on ActiveRecord object inside email

I simply needed one helper method which would help me highlight changes being made on any ActiveRecord object inside email. Below is one example of that I have come up with and would like to extend it in my future projects too.

It gave me some insights into ActiveRecord::Base#previous_changes and ActiveRecord::Base#reflections. Nice to learn such ActiveRecord features.

samg/diffy also helped me out decorating text changes

Screenshot from 2014-01-16 13:50:15

Adding to my MailerHelper

Advertisements