title: Marshal or Serialize an ActiveRecord object
body: <p>I'm using rails 3.2 and Ruby 1.9.3</p>
  
  <p>I have a need to store data in Redis for caching purposes. The data element I want to save is a hash of different types of elements -- some of which are currently ActiveRecord objects.</p>
  
  <p>I want to store this compound object in redis (an in-memory key/value store). To do so I need to serialize / deserialize the compound object in a way that brings it back together correctly.</p>
  
  <p>How can I serialize or marshal this hash so it comes back together into the same set of objects when I pull it out of cache?</p>