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.
|