On Friday, August 24, 2012 11:46:35 AM UTC+1, Azhaguselvan SP wrote: > > Hi, > > When trying to store a Array or Hash to a string field, ActiveRecord > automatically > serializes them to yaml. If that's so why is there a special option > called serialize? > > The automatic serialization is just a side effect that everything has to be forced into a string before active record will have it. Because Active Record doesn't know that the column is a serialzied one, when you try and retrieve the value you'll just get the raw yaml string. Using serialise tells Active Record to unserialize when reading.
Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/U9S5Hu5M6DUJ. For more options, visit https://groups.google.com/groups/opt_out.

