Bugs item #25340, was opened at 2009-04-10 04:41
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=25340&group_id=2014

Category: AR-JDBC
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: JdbcSpec::MsSQL::Column#type_cast causes exception with serialized 
fields

Initial Comment:
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.


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=25340&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to