Selecting "FIELD AS NAME" in ActiveRecord Always Returns String

If I select “field as alt_field_name”, the value will always come out as String, not what the field actually is.


>> User.find(:first, :select => :created_at).created_at
=> Wed Jan 24 00:04:59 UTC 2007
>> User.find(:first, :select => "created_at").created_at
=> Wed Jan 24 00:04:59 UTC 2007
>> User.find(:first, :select => "created_at as created__at").created__at
=> "2007-01-24 00:04:59"

Categories: ruby |