instance method
timestamps
Ruby on Rails 7.2.3
Since v2.2.3Signature
timestamps(**options)
Appends :datetime columns :created_at and :updated_at to the table. See connection.add_timestamps
t.timestamps null: false
Parameters
-
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 534
def timestamps(**options)
options[:null] = false if options[:null].nil?
if !options.key?(:precision) && @conn.supports_datetime_with_precision?
options[:precision] = 6
end
column(:created_at, :datetime, **options)
column(:updated_at, :datetime, **options)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 534
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::TableDefinition