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
- #all_timestamp_attributes_in_model
- #current_time_from_proper_timezone
- #timestamp_attributes_for_create_in_model
- #timestamp_attributes_for_update_in_model
- #touch_attributes_with_time(*names, time: nil)
- #reload_schema_from_cache(recursive = true) protected
- #timestamp_attributes_for_create private
- #timestamp_attributes_for_update private
Instance Method Details
#all_timestamp_attributes_in_model
[ GitHub ]# File 'activerecord/lib/active_record/timestamp.rb', line 72
def @all_timestamp_attributes_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 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 ["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 ||= ( & column_names).freeze end
#timestamp_attributes_for_update (private)
[ GitHub ]# File 'activerecord/lib/active_record/timestamp.rb', line 94
def ["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 ||= ( & 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 = attribute_names |= names.map(&:to_s) attribute_names.index_with(time || current_time_from_proper_timezone) end