Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.5.3, JRuby 1.5.6, JRuby 1.6RC1
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:OS X 10.6.6; Java build 1.6.0_22-b04-307-10M3261
-
Number of attachments :
Description
I've encountered an odd but replicable problem with ActiveRecord 2.3.10, decimal PKs, and JRuby 1.5.x. It is still present in 1.6.0.RC1. It's described in detail in this message to the mailing list:
http://markmail.org/message/j4qmmnlyf4mvkw3m
There's a script to reproduce in this gist:
https://gist.github.com/792546
The stacktrace on JRuby 1.6.0.RC1 points to RubyBigDecimal, but I did not find any other bugs registered there that seemed relevant.
Monkey patch:
require 'active_record/base' if RUBY_PLATFORM == 'java' && [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [2, 3] class ActiveRecord::Base private alias :convert_number_column_value_without_patch :convert_number_column_value def convert_number_column_value(value) if value.is_a?(BigDecimal) value else convert_number_column_value_without_patch(value) end end end end