# Activerecord access raw serialized data

**URL:** <https://www.ruby-forum.com/t/activerecord-access-raw-serialized-data/159152>\
**Category:** Rails\
**Created:** [February 1, 2009, 2:33pm UTC](https://www.ruby-forum.com/t/activerecord-access-raw-serialized-data/159152 "2009-02-01T14:33:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arvias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@arvias](https://www.ruby-forum.com/u/arvias)\
**Post date:** [February 1, 2009, 2:33pm UTC](https://www.ruby-forum.com/t/activerecord-access-raw-serialized-data/159152/1 "2009-02-01T14:33:57Z")

</div>

Hi,

I have a model with a serialized field ‘other\_data’.

How can I add raw YAML data to that field?

If i try:  
model[other\_data] = yaml\_formatted\_data  
yaml\_formatted\_data gets YAML formatted again.

–  
cheers,  
M.

---

<div class="post-metadata">

**Author:** ![arvias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@arvias](https://www.ruby-forum.com/u/arvias)\
**Post date:** [February 1, 2009, 3:07pm UTC](https://www.ruby-forum.com/t/activerecord-access-raw-serialized-data/159152/2 "2009-02-01T15:07:23Z")

</div>

Marcelo B. wrote:

> I have a model with a serialized field ‘other\_data’.
> 
> How can I add raw YAML data to that field?
> 
> If i try:  
> model[other\_data] = yaml\_formatted\_data  
> yaml\_formatted\_data gets YAML formatted again.

I’m not sure why you don’t want the serializer to do it for you. You  
could also  
try model.other\_data = YAML::load(yaml\_formatted\_data)…

But try model.attributes[:other\_data]!
