A
Aaron Vegh
Hi there,
For a Rails project, I'm trying to serialize some data in a hash, using
Marshal. However, this data is getting serialized in unexpected ways.
I'm not sure if there's a problem with Marshal, my data, or me.
In Rails, I have a parameter that is a hash of data from a form:
{"305"=>"Complete trim detail at top of stringer where basement
staircase meets first floor level. ",
"25"=>"The vertical joint between the two adjacent masonry wythes at
the ... do not appear to be bonded or tied together. Cracking of the
mortar is resulting. \t\t\t\t\t\t
",
"728"=>"The mantle above factory built fireplace in the family room has
been installed in an un-workmanlike manner. Gaps between the mantle and
wall are too excessive. "}
In my controller, I serialize the data with Marshal:
data = Marshal.dump(p)
But when I save it, I get an error. Here's the beginning of it:
SQLite3::SQLException: unrecognized token:
"'C:HashWithIndifferentAccess{"305"": UPDATE "reports" SET
"updated_at" = '2009-10-07 14:49:26', "data" =
'C:HashWithIndifferentAccess..."
I logged the result of that Marshal call, and this is what I got:
C:HashWithIndifferentAccess305"`Complete trim detail at top of stringer
where basement staircase meets first floor level. "25"?The vertical
joint between the two adjacent masonry wythes at the ... do not appear
to be bonded or tied together. Cracking of the mortar is resulting.
728"?The mantle above factory built fireplace in the family room has
been installed in an un-workmanlike manner. Gaps between the mantle and
wall are too excessive.
Which to me doesn't look at all like what Marshal should be producing.
So what gives?
Thanks,
Aaron.
For a Rails project, I'm trying to serialize some data in a hash, using
Marshal. However, this data is getting serialized in unexpected ways.
I'm not sure if there's a problem with Marshal, my data, or me.
In Rails, I have a parameter that is a hash of data from a form:
{"305"=>"Complete trim detail at top of stringer where basement
staircase meets first floor level. ",
"25"=>"The vertical joint between the two adjacent masonry wythes at
the ... do not appear to be bonded or tied together. Cracking of the
mortar is resulting. \t\t\t\t\t\t
",
"728"=>"The mantle above factory built fireplace in the family room has
been installed in an un-workmanlike manner. Gaps between the mantle and
wall are too excessive. "}
In my controller, I serialize the data with Marshal:
data = Marshal.dump(p)
But when I save it, I get an error. Here's the beginning of it:
SQLite3::SQLException: unrecognized token:
"'C:HashWithIndifferentAccess{"305"": UPDATE "reports" SET
"updated_at" = '2009-10-07 14:49:26', "data" =
'C:HashWithIndifferentAccess..."
I logged the result of that Marshal call, and this is what I got:
C:HashWithIndifferentAccess305"`Complete trim detail at top of stringer
where basement staircase meets first floor level. "25"?The vertical
joint between the two adjacent masonry wythes at the ... do not appear
to be bonded or tied together. Cracking of the mortar is resulting.
728"?The mantle above factory built fireplace in the family room has
been installed in an un-workmanlike manner. Gaps between the mantle and
wall are too excessive.
Which to me doesn't look at all like what Marshal should be producing.
So what gives?
Thanks,
Aaron.