From: Greg Hauptmann Date: 2009-03-05T16:13:54+09:00 Subject: with YAML can I retrieve the class type back??? --001636ed63f46c913e046459eef8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, If I wanted to persist different Ruby types (e.g. float, BigDecimal, integer, string) to a database based table (e.g. column names KEY and VALUE), if I use the "to_yaml" method to serialize their values and store them as strings, what's the easiest way to retrieve them back to a Ruby variable such that they are of the original type (i.e. not a YAML type). E.g. Want to be able to do things such as (assume I have a model called Config): Config.create!(:key => "interest_rate", :value => BigDecimal('12.12').to_yaml) Config.create!(:key => "age", :value => 12.to_yaml) and then later ir = Config.find_by_key('interest_rate") # and the variable should be of type BigDecimal ir = Config.find_by_key('age") # and the variable should be of type Integer etc -- Greg http://blog.gregnet.org/ --001636ed63f46c913e046459eef8--