Sha256: a928b2d7bba1a0987664e545d12e9edb6baa55927834634653bb400e7ba99a2e
Contents?: true
Size: 867 Bytes
Versions: 3
Compression:
Stored size: 867 Bytes
Contents
require 'active_record/connection_adapters/abstract/quoting' module Activerecord module Time module Quoting def _quote(value) return "'#{value}'" if value.is_a?(TimeOfDay) super(value) end def _type_cast(value) return value.to_s if value.is_a?(TimeOfDay) super(value) end end end end # ActiveRecord::ConnectionAdapters::Quoting.prepend Activerecord::Time::Quoting ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend Activerecord::Time::Quoting module ActiveRecord module Type class Time < ActiveModel::Type::Time # :nodoc: private def cast_value(value) return value.time_of_day if value.is_a?(::DateTime) || value.is_a?(::Time) return value unless value.is_a?(::String) return if value.empty? TimeOfDay._parse(value) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems