Bugs: Browse | Submit New | Admin

[#25340] JdbcSpec::MsSQL::Column#type_cast causes exception with serialized fields

Date:
2009-04-10 08:41
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
AR-JDBC
State:
Open
Summary:
JdbcSpec::MsSQL::Column#type_cast causes exception with serialized fields

Detailed description
Working with Rails 2.3.2 and activerecord-jdbc-adapter 0.9.1 I found that in the case of assigning a serializable object
to serialized fields the #field_changed? method causes a call to JdbcSpec::MsSQL::Column#type_cast where, based on the
fact that the column type is :string, JdbcSpec::MsSQL::Column#unquote_string is called on the assigned, unconverted,
value without checking to see if the value is indeed a String.
The result (in my case) is an exception caused by calling private method #sub on a Hash object.

I fixed this by patching #unquote_string to do nothing in case the value is not a String. This works fine since AR doesn't
really need to call #type_cast in #field_changed? as I found in another part that AR *always* updates serialized fields.
I'm not really sure what the 'correct' change needs to be here though.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item