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
  schema_context.all_timestamp_attributes_in_model
end

#current_time_from_proper_timezone

[ GitHub ]

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

def current_time_from_proper_timezone
  with_connection { |c| c.default_timezone == :utc ? Time.now.utc : Time.now }
end

#timestamp_attributes_for_create

[ GitHub ]

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

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 64

def timestamp_attributes_for_create_in_model
  schema_context.timestamp_attributes_for_create_in_model
end

#timestamp_attributes_for_update

[ GitHub ]

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

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 68

def timestamp_attributes_for_update_in_model
  schema_context.timestamp_attributes_for_update_in_model
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)
  names = names.map(&:to_s)
  names = names.map { |name| attribute_aliases[name] || name }
  attribute_names = timestamp_attributes_for_update_in_model
  attribute_names |= names
  attribute_names.index_with(time || current_time_from_proper_timezone)
end