# Undefined AR class module for Marshal

**URL:** <https://www.ruby-forum.com/t/undefined-ar-class-module-for-marshal/110200>\
**Category:** Rails\
**Created:** [July 24, 2007, 5:15am UTC](https://www.ruby-forum.com/t/undefined-ar-class-module-for-marshal/110200 "2007-07-24T05:15:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [July 24, 2007, 5:15am UTC](https://www.ruby-forum.com/t/undefined-ar-class-module-for-marshal/110200/1 "2007-07-24T05:15:23Z")

</div>

When I do Marshal.load, and the data includes AR classes, it gives me an  
undefined class/module error along with the AR class name.

If I require the model files right before calling Marshal.load, it will  
work fine. I don’t want to be requiring the AR models everytime I call  
Marshal.load.

Whats confusing is that if I do any kind of AR actions/methods (i.e.  
Model.find), it will work fine without having to require the models  
again.

Why do I have to re-require the AR models if I Marshal.load the AR  
object?

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [November 15, 2007, 10:14pm UTC](https://www.ruby-forum.com/t/undefined-ar-class-module-for-marshal/110200/2 "2007-11-15T22:14:14Z")

</div>

This consistently happens to me still with unmarshalling data.

Is there any work around to this?
