class ActiveRecord::ConnectionAdapters::SQLServer::Type::DateTime
Public Instance Methods
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 23 def deserialize(value) value.is_a?(Data) ? super(value.value) : super end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 31 def quoted(value) Utils.quote_string_single(value) end
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 14 def serialize(value) value = super return value unless value.acts_like?(:time) datetime = "#{value.to_formatted_s(:_sqlserver_datetime)}.#{quote_fractional(value)}" Data.new datetime, self end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 10 def sqlserver_type "datetime" end
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 27 def type_cast_for_schema(value) serialize(value).quoted end
Private Instance Methods
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 37 def fast_string_to_time(string) time = ActiveSupport::TimeZone["UTC"].strptime(string, fast_string_to_time_format) new_time(time.year, time.month, time.day, time.hour, time.min, time.sec, Rational(time.nsec, 1_000)) rescue ArgumentError super end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver/type/datetime.rb, line 45 def fast_string_to_time_format "#{::Time::DATE_FORMATS[:_sqlserver_datetime]}.%N" end