Chronicling my experiences with ruby on rails, web application development/management.

Friday, November 21, 2008

Serialize... what the #@#&%!!?

Ok. For all my loyal readers, here is one thing that just wasn't jiving for me.

Serialize is Killing me!

Serialize :column is code that should be put into your model.

What that little line does is save whatever code you save to that column as yaml. Oh and make sure :column is a type :string.

Without doing anything to the column upon saving, this is an example of what could be in your db.

column: "--- \n- subscription\n- membership\n"

Now supposedly, all i have to do to use this string of yaml is to call it like i normally would, say in a for loop, and it 'un yaml fies' itself. No such luck.

What tricks do you guys use when you are serializing? i'll take any help here.

Update 11-28-08

As my exploits from Railsforum will show, i got it to work finally. Thanks to rob-wtf from Railsforum for the help!

P.s. I bookmarked their paperclip article... it's pretty good. Well minus the windows stuff.

No comments:

Post a Comment