Sha256: a98b29ab58c5891c4c8eb24de7dcb4b36cb79316465cd09020f09fb3388967a8
Contents?: true
Size: 831 Bytes
Versions: 3
Compression:
Stored size: 831 Bytes
Contents
=begin This monkey patch is necessary because adapters with version 5.x and up are smart enough to encode strings that come in with Encoding::ASCII-8BIT to Encoding::UTF-8 but others aren't. So to mimic the worst case, for example using a bad oracle adapter, we monkey patch the SQLite3Adapter to just return the string instead of trying to encode it using utf8. =end require 'active_record/connection_adapters/sqlite3_adapter' module ActiveRecord module ConnectionAdapters class SQLite3Adapter < AbstractAdapter private def _type_cast(value) case value when BigDecimal value.to_f when String if value.encoding == Encoding::ASCII_8BIT value else super end else super end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gigo-activerecord-2.0.2 | test/sqlite3_monkey_patch.rb |
gigo-activerecord-2.0.1 | test/sqlite3_monkey_patch.rb |
gigo-activerecord-2.0.0 | test/sqlite3_monkey_patch.rb |