instance method
add_timestamps
Ruby on Rails 4.2.9
Since v2.2.3Signature
add_timestamps(table_name, options = {})
Adds timestamps (created_at and updated_at) columns to table_name. Additional options (like null: false) are forwarded to #add_column.
add_timestamps(:suppliers, null: false)
Parameters
-
table_namereq -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 907
def add_timestamps(table_name, options = {})
emit_warning_if_null_unspecified(:add_timestamps, options)
add_column table_name, :created_at, :datetime, options
add_column table_name, :updated_at, :datetime, options
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 907
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements