Module: ActiveRecord::Timestamp::ClassMethods
- Defined in:
- lib/active_record/timestamp.rb
Overview
:nodoc:
Instance Method Summary collapse
- #all_timestamp_attributes_in_model ⇒ Object
- #current_time_from_proper_timezone ⇒ Object
- #timestamp_attributes_for_create_in_model ⇒ Object
- #timestamp_attributes_for_update_in_model ⇒ Object
- #touch_attributes_with_time(*names, time: nil) ⇒ Object
Instance Method Details
#all_timestamp_attributes_in_model ⇒ Object
72 73 74 75 |
# File 'lib/active_record/timestamp.rb', line 72 def @all_timestamp_attributes_in_model ||= ( + ).freeze end |
#current_time_from_proper_timezone ⇒ Object
77 78 79 |
# File 'lib/active_record/timestamp.rb', line 77 def current_time_from_proper_timezone default_timezone == :utc ? Time.now.utc : Time.now end |
#timestamp_attributes_for_create_in_model ⇒ Object
62 63 64 65 |
# File 'lib/active_record/timestamp.rb', line 62 def @timestamp_attributes_for_create_in_model ||= ( & column_names).freeze end |
#timestamp_attributes_for_update_in_model ⇒ Object
67 68 69 70 |
# File '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) ⇒ Object
56 57 58 59 60 |
# File '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 |