# Inconsistent serialization-getting YAML::Syck object not has

**URL:** <https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734>\
**Category:** Rails\
**Created:** [November 7, 2006, 10:54am UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734 "2006-11-07T10:54:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Welty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@Paul\_Welty](https://www.ruby-forum.com/u/Paul_Welty)\
**Post date:** [November 7, 2006, 10:54am UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734/1 "2006-11-07T10:54:37Z")

</div>

I have a field that’s serialized in my model with “serialize :field”.  
This  
works fine going back and forth to a hash in Locomotive in development.  
‘field’ always comes out as a hash. So, in development, I get a  
YAML::dump  
like this:

!map:HashWithIndifferentAccess  
key1: “value1”  
key2: “value2”

But, in production on DreamHost, the deseralization ends up like this:

!ruby/object:YAML::Syck::DomainType  
domain: [yaml.org](http://yaml.org),2002  
type\_id: map:HashWithIndifferentAccess  
value:  
key1: “value1”  
key2: “value2”

Thus, of course, I can’t use the hash methods. And Rails then generates  
errors like “undefined method `include?’ for  
#YAML::Syck::DomainType:0x407fb584”. And this, of course, breaks the  
whole  
app.

I’m using Rails 1.1.6, and so is DreamHost. Does anyone have any ideas  
What might be going on?

-Paul

---

<div class="post-metadata">

**Author:** ![Paul\_Welty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@Paul\_Welty](https://www.ruby-forum.com/u/Paul_Welty)\
**Post date:** [November 10, 2006, 2:00pm UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734/2 "2006-11-10T14:00:10Z")

</div>

Paul Welty wrote:

> app.
> 
> I’m using Rails 1.1.6, and so is DreamHost. Does anyone have any ideas  
> What might be going on?
> 
> -Paul

I tried “rake freeze\_gems”, but that doesn’t have any effect.

I checked on DreamHost, and they are using Ruby 1.8.2, but Locomotive  
uses 1.8.4. Could that be the problem?

-Paul

---

<div class="post-metadata">

**Author:** ![Paul\_Welty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@Paul\_Welty](https://www.ruby-forum.com/u/Paul_Welty)\
**Post date:** [November 17, 2006, 2:56pm UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734/3 "2006-11-17T14:56:09Z")

</div>

I realize I’m the only person talking in this thread, but this problem  
is killing me.

I tried installing custom Ruby on DreamHost and using 1.8.4. In fact, I  
created an entire custom Rails environment. But, nothing makes the  
slightest difference.

So, it seems like there are different YAML::Syck modules on different  
platforms. Could this be right?

If so, shouldn’t someone have run into this problem before?

---

<div class="post-metadata">

**Author:** ![Paul\_Welty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@Paul\_Welty](https://www.ruby-forum.com/u/Paul_Welty)\
**Post date:** [November 17, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734/4 "2006-11-17T15:12:12Z")

</div>

On 11/17/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If so, shouldn’t someone have run into this problem before?

Try serializing a Hash instead of a HashWithIndifferentAccess.  
Then you’ll get compatible YAML across Syck versions.

jeremy

---

<div class="post-metadata">

**Author:** ![Paul\_Welty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@Paul\_Welty](https://www.ruby-forum.com/u/Paul_Welty)\
**Post date:** [November 17, 2006, 4:12pm UTC](https://www.ruby-forum.com/t/inconsistent-serialization-getting-yaml-syck-object-not-has/74734/5 "2006-11-17T16:12:23Z")

</div>

Thanks! That seems to have worked. I never would have guessed that, so  
I really appreciate it.

-Paul
