Class: ActiveRecord::ConnectionAdapters::MysqlAdapter::Fields::Time

Inherits:
Type::Time show all
Defined in:
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Type::Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods inherited from Type::Time

#type

Methods included from Type::TimeValue

#klass, #type_cast_for_schema

Methods inherited from Type::Value

#==, #binary?, #changed?, #changed_in_place?, #hash, #initialize, #klass, #number?, #text?, #type, #type_cast_for_database, #type_cast_for_schema, #type_cast_from_database, #type_cast_from_user

Constructor Details

This class inherits a constructor from ActiveRecord::Type::Value

Instance Method Details

#cast_value(value) ⇒ Object


292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb', line 292

def cast_value(value)
  if Mysql::Time === value
    new_time(
      2000,
      01,
      01,
      value.hour,
      value.minute,
      value.second,
      value.second_part)
  else
    super
  end
end