From: Malte Milatz Date: 2005-04-18T20:44:37+09:00 Subject: Re: String<->float conversion headaches pmak: > I write this sort of thing all the time in Perl and don't have trouble > because of its automatic type conversion. What would be the best way to do > this in Ruby? Right now I'm writing: > > source['salary'] = source['salary'].to_f - > encumbered['salary'].to_f > > everywhere and it feels quite tedious. Write a simple class around your MySql table doing the conversion behind the scenes. If you like something like this automatically, then ActiveRecord (a library which is part of RubyOnRails) is what you're looking for. If, on the other hand, you'd like a class which creates an SQL table from your class definition, then you might have a look at Og, for which a tutorial can be found at rubygarden.org. Or maybe I understood your question the wrong way - is the salary in the example above saved as in the database as a float or as a string? Malte