From c5131b62b7df8aff07875b76131ec03af360fb35 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 30 Mar 2016 20:57:14 +0900 Subject: Make to private the visibility of `_quote` and `_type_cast` --- .../connection_adapters/sqlite3/quoting.rb | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb (limited to 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb new file mode 100644 index 0000000000..3bfd0ba055 --- /dev/null +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb @@ -0,0 +1,32 @@ +module ActiveRecord + module ConnectionAdapters + module SQLite3 + module Quoting # :nodoc: + private + + def _quote(value) + if value.is_a?(Type::Binary::Data) + "x'#{value.hex}'" + else + super + end + end + + def _type_cast(value) + case value + when BigDecimal + value.to_f + when String + if value.encoding == Encoding::ASCII_8BIT + super(value.encode(Encoding::UTF_8)) + else + super + end + else + super + end + end + end + end + end +end -- cgit v1.2.3