Forum: Ruby on Rails Specifying a binary field in test fixtures

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2005-12-12 15:48
(Received via mailing list)
One of my fields holds binary data (a serialized object), and I'd like
to be able to create fixtures that have this data.  I can just use erb
to build the object, but I don't know how to write the fixture file
such that the object is serialized.  Anyone know how to do this?
24d2f8804e6bb4b7ea6bd11e0a586470?d=identicon&s=25 Jeremy Kemper (Guest)
on 2005-12-12 15:54
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 12, 2005, at 6:46 AM, Pat Maddox wrote:
> One of my fields holds binary data (a serialized object), and I'd like
> to be able to create fixtures that have this data.  I can just use erb
> to build the object, but I don't know how to write the fixture file
> such that the object is serialized.  Anyone know how to do this?

YAML supports Base64-encoded binary values
   http://yaml.org/type/binary.html

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDnY5LAQHALep9HFYRAoA1AJ0QjxLKuxqvPBAnldlNam5jdKfy1QCcD5Rz
vGIZ0S0QL/9bSFxSVtNPSb8=
=4xtR
-----END PGP SIGNATURE-----
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2005-12-12 16:24
(Received via mailing list)
How do I specify this in the YAML file?  And then when I'm accessing
the object, how do I ensure that it's an object of the type I want,
not just a string stored in the db?

Pat
This topic is locked and can not be replied to.