module ActiveRecord::Timestamp::ClassMethods
def all_timestamp_attributes_in_model
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
def current_time_from_proper_timezone
def current_time_from_proper_timezone ActiveRecord.default_timezone == :utc ? Time.now.utc : Time.now end
def reload_schema_from_cache
def reload_schema_from_cache @timestamp_attributes_for_create_in_model = nil @timestamp_attributes_for_update_in_model = nil @all_timestamp_attributes_in_model = nil super end
def timestamp_attributes_for_create
def timestamp_attributes_for_create ["created_at", "created_on"].map! { |name| attribute_aliases[name] || name } end
def timestamp_attributes_for_create_in_model
def timestamp_attributes_for_create_in_model @timestamp_attributes_for_create_in_model ||= (timestamp_attributes_for_create & column_names).freeze end
def timestamp_attributes_for_update
def timestamp_attributes_for_update ["updated_at", "updated_on"].map! { |name| attribute_aliases[name] || name } end
def timestamp_attributes_for_update_in_model
def timestamp_attributes_for_update_in_model @timestamp_attributes_for_update_in_model ||= (timestamp_attributes_for_update & column_names).freeze end
def touch_attributes_with_time(*names, time: nil)
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