123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::Timestamp::ClassMethods

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: activerecord/lib/active_record/timestamp.rb

Instance Method Summary

Instance Method Details

#all_timestamp_attributes_in_model

[ GitHub ]

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

def all_timestamp_attributes_in_model
  @all_timestamp_attributes_in_model ||=
    (timestamp_attributes_for_create_in_model + timestamp_attributes_for_update_in_model).freeze
end

#current_time_from_proper_timezone

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 77

def current_time_from_proper_timezone
  lease_connection.default_timezone == :utc ? Time.now.utc : Time.now
end

#reload_schema_from_cache(recursive = true) (protected)

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 82

def reload_schema_from_cache(recursive = true)
  @timestamp_attributes_for_create_in_model = nil
  @timestamp_attributes_for_update_in_model = nil
  @all_timestamp_attributes_in_model = nil
  super
end

#timestamp_attributes_for_create (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 90

def timestamp_attributes_for_create
  ["created_at", "created_on"].map! { |name| attribute_aliases[name] || name }
end

#timestamp_attributes_for_create_in_model

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 62

def timestamp_attributes_for_create_in_model
  @timestamp_attributes_for_create_in_model ||=
    (timestamp_attributes_for_create & column_names).freeze
end

#timestamp_attributes_for_update (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 94

def timestamp_attributes_for_update
  ["updated_at", "updated_on"].map! { |name| attribute_aliases[name] || name }
end

#timestamp_attributes_for_update_in_model

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 67

def timestamp_attributes_for_update_in_model
  @timestamp_attributes_for_update_in_model ||=
    (timestamp_attributes_for_update & column_names).freeze
end

#touch_attributes_with_time(*names, time: nil)

[ GitHub ]

  
# File 'activerecord/lib/active_record/timestamp.rb', line 56

def touch_attributes_with_time(*names, time: nil)
  attribute_names = timestamp_attributes_for_update_in_model
  attribute_names |= names.map(&:to_s)
  attribute_names.index_with(time || current_time_from_proper_timezone)
end