123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods

Do not use. This module is for internal use only.

Instance Method Summary

Instance Method Details

#create_time_zone_conversion_attribute?(name, cast_type) ⇒ Boolean (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb', line 80

def create_time_zone_conversion_attribute?(name, cast_type)
  enabled_for_column = time_zone_aware_attributes &&
    !skip_time_zone_conversion_for_attributes.include?(name.to_sym)

  enabled_for_column && time_zone_aware_types.include?(cast_type.type)
end

#define_attribute(name, cast_type)

[ GitHub ]

  
# File 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb', line 72

def define_attribute(name, cast_type, **)
  if create_time_zone_conversion_attribute?(name, cast_type)
    cast_type = TimeZoneConverter.new(cast_type)
  end
  super
end