Rails ActiveSupport #constantize method provides an api for your application to create a constant from a string. ‘Post’.constantize #=> Post But… be sure your strings are capitalized or Rails won’t find the relating constant. ‘post’.constantize #=> NameError: wrong constant name post   ‘post’.camelize.constantize #=> Post :)

ActiveRecord::Dirty gives us methods to inspect objects which have a changed stated in the system. The method “changes” from the library provides a hash like the following: course.changes # => {"name" => ["Science", "Chemistry"]} This is only half the battle for most use cases. This example shows how to loop your changed attribute with a key for display. def display_changes props = {} changes.each do |attr, value| props[attr] = value.last end props end   >> course.display_changes => {"name" => "Chemistry"} This leaves us with a simple hash of changes. :)