module GBDate::ActiveRecord::Type::DateTime

Public Instance Methods

cast_value(value) click to toggle source
Calls superclass method
# File lib/gb_date/active_record/type/date_time.rb, line 6
def cast_value(value)
  return ::Time.at(value) if value.is_a? Numeric
  super value
end
fast_string_to_time(string) click to toggle source
Calls superclass method
# File lib/gb_date/active_record/type/date_time.rb, line 16
def fast_string_to_time(string)
  if string =~ ::ActiveRecord::ConnectionAdapters::Column::Format::NUMERIC_TIME
    ::Time.at(string.to_f)
  else
    super string
  end
end
type_cast_for_database(value) click to toggle source
Calls superclass method
# File lib/gb_date/active_record/type/date_time.rb, line 11
def type_cast_for_database(value)
  value = ::Time.at(value) if value.is_a? Numeric
  super value
end