Closed yahonda closed 7 years ago
I'm not familiar with Ruby development itself then these errors "may" be related with these "ArgumentError: invalid value for BigDecimal():"
https://bugs.ruby-lang.org/issues/10286 https://bugs.ruby-lang.org/issues/12718
I'm asking questions about this change. https://github.com/ruby/bigdecimal/issues/47
I've got an answer to the above. This behavior is a new specification since Ruby 2.4.0.
And I opened PR to solve this Issue. https://github.com/kubo/ruby-oci8/pull/144
Thanks.
@yahonda Thank you for the report. I merged @koic's PR.
This is still an issue with Ruby 2.4.1 and Rails 4.2.8. Attempted fixing with gem 'bigdecimal', '>=1.3.5' but in vain.
I fixed this by applying a patch:
module DecimalCastRescueRuby24
def cast_value(value)
if value.is_a?(::String)
begin
super(value)
rescue ArgumentError
BigDecimal(0)
end
else
super(value)
end
end
end
ActiveRecord::Type::Decimal.prepend DecimalCastRescueRuby24
@steady-daddy I think you're missing the first line of your patch. Probably module DecimalCastRescueRuby24
?
@contentfree Thanks for pointing that out. I corrected that. It was there but somehow got hidden by the formatting operator.
This issue has been opened as https://github.com/rsim/oracle-enhanced/issues/1085 and found it also reproduces ruby-oci8 ifself.
OPatch succeeded. $
Install ruby 2.4.0 rc1 using rbenv and ruby-build
check out the latest version of
ruby-oci8
Execute
ruby setup.rb config
,ruby setup.rb setup
Execute
make check
Results:
It does not reproduce with
ruby 2.4.0preview3