diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-03-30 13:32:44 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-03-30 13:32:44 -0600 |
commit | a564fecbd0c96815664067b727817045459cae98 (patch) | |
tree | eac9906f5257e6470b1be314d39874387896d0f4 /activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb | |
parent | e3056bc9f4a6a327bcfeacf2e979ffaec3c56cdd (diff) | |
parent | c5131b62b7df8aff07875b76131ec03af360fb35 (diff) | |
download | rails-a564fecbd0c96815664067b727817045459cae98.tar.gz rails-a564fecbd0c96815664067b727817045459cae98.tar.bz2 rails-a564fecbd0c96815664067b727817045459cae98.zip |
Merge pull request #24368 from kamipo/make_to_private_the_visibility
Make to private the visibility of `_quote` and `_type_cast`
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb | 32 |
1 files changed, 32 insertions, 0 deletions
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 |