Serializing ActiveRecord objects without storing their attributes?
        Posted  
        
            by Allan Grant
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Allan Grant
        
        
        
        Published on 2010-03-26T07:48:08Z
        Indexed on 
            2010/03/26
            7:53 UTC
        
        
        Read the original article
        Hit count: 331
        
I'm working on a problem where I need to store serialized hierarchies of Ruby objects in the database. Many of the objects that will need to be saved are ActiveRecord objects with a lot of attributes. Instead of saving the entire objects and then refreshing their attributes from the DB when I load them (in case they changed, which is likely), it would be easier to just store the references (class and database id) for these objects.
Does anyone know if there's already a way to do this in Rails, or if there's an existing gem for it? Wanted to check if something existed before spending a ton of time hacking on it.
© Stack Overflow or respective owner