instance method
timestamps
Ruby on Rails 5.2.8.1
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 395
def timestamps(**options)
options[:null] = false if options[:null].nil?
column(:created_at, :datetime, options)
column(:updated_at, :datetime, options)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 395
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::TableDefinition