Ruby on Rails Tuesday, May 24, 2016



On Monday, May 23, 2016 at 1:12:33 PM UTC+1, Alessio Varalta wrote:

If i put in the model


serialize :birthplace, Hash


is correct but i have a diffrent format {:it=>"Padova",:de=>"Padovan"}


I read in the last part of this document

http://apidock.com/rails/ActiveRecord/AttributeMethods/Serialization/ClassMethods/serialize 

that Yaml is the default serialization and generate a string ---\n....



This is the right thing to do. You don't see the yaml in your app because rails is doing the conversion to/from yaml for you. If you were to look at your column with a non rails database tool then you would see the raw serialised data.

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f8dbdd59-9bd6-487b-93c2-1326ee9418a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment