Class: Mongoid::Fields::Internal::Time

Inherits:
Object
  • Object
show all
Includes:
Timekeeping, Serializable
Defined in:
lib/mongoid/fields/internal/time.rb

Overview

Defines the behaviour for date fields.

Instance Attribute Summary

Attributes included from Serializable

#default_val, #label, #localize, #name, #options

Instance Method Summary collapse

Methods included from Timekeeping

#convert_to_time, #deserialize, #selection, #serialize, #strip_milliseconds

Methods included from Serializable

#constraint, #deserialize, #eval_default, #foreign_key?, #localized?, #metadata, #object_id_field?, #resizable?, #selection, #serialize, #type, #versioned?

Instance Method Details

#cast_on_read?true

When reading the field do we need to cast the value? This holds true when times are stored or for big decimals which are stored as strings.

Examples:

Typecast on a read?

field.cast_on_read?

Returns:

  • (true)

    Date fields cast on read.

Since:

  • 2.1.0



19
# File 'lib/mongoid/fields/internal/time.rb', line 19

def cast_on_read?; true; end