Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Incomplete
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Miscellaneous
-
Labels:None
-
Environment:Rails 3.0.7, JRuby 1.6.4, MySQL
-
Number of attachments :
Description
Custom selected fields are returned as strings in JRuby, while in MRI are converted to appropriate class.
Here is a very simple example. Having User model with created_at datetime field MRI returns Time object:
ruby-1.8.7-p330 :001 > User.select('created_at AS custom_created_at').first.custom_created_at.class
=> Time
while JRuby returns string:
jruby-1.6.4 :029 > User.select('created_at AS custom_created_at').first.custom_created_at.class
=> String
The same problem is with other field types.
You might get a quicker response filing this at the AR-JDBC JIRA (http://kenai.com/jira/browse/ACTIVERECORD_JDBC) or at the Github isssues (https://github.com/jruby/activerecord-jdbc-adapter/issues).
To clarify...the created_at field in the database is of type DATETIME and we're returning it as a string, yes? Is it possible for you to create a simple script that demonstrates the problem, so we know exactly how to reproduce?