Forum: Ruby on Rails find_by_sql returns Strings! How to I type cast?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Chris Richards (chris)
on 2009-04-07 00:35
When i run find_by_sql the extra fields not in the Model  are returned
as Strings.

What is the correct way to convert all the extra fields to their correct
type?  Is there a way to somehow define these extra fields in the Model
class to ensure they will always be returned correctly? Or is their a
better method.

I will be using find_by_sql a lot so a clean solution would be good.
(I am using Mysql)s

Thanks in advance
This topic is locked and can not be replied to.