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,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
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
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?
On 11/17/06, [email protected] [email protected] 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
Thanks! That seems to have worked. I never would have guessed that, so
I really appreciate it.
-Paul