Module: Code0::ZeroTrack::Database::ColumnMethods::Timestamps
- Defined in:
- lib/code0/zero_track/database/column_methods.rb
Instance Method Summary collapse
-
#datetime_with_timezone(column_name, **options) ⇒ Object
Adds specified column with appropriate timestamp type.
-
#timestamps_with_timezone(**options) ⇒ Object
Appends columns ‘created_at` and `updated_at` to a table.
Instance Method Details
#datetime_with_timezone(column_name, **options) ⇒ Object
Adds specified column with appropriate timestamp type
It is used in table creation like: create_table ‘users’ do |t|
t.datetime_with_timezone :did_something_at
end
28 29 30 |
# File 'lib/code0/zero_track/database/column_methods.rb', line 28 def datetime_with_timezone(column_name, **) column(column_name, :datetime_with_timezone, **) end |
#timestamps_with_timezone(**options) ⇒ Object
Appends columns ‘created_at` and `updated_at` to a table.
It is used in table creation like: create_table ‘users’ do |t|
t.
end
14 15 16 17 18 19 20 |
# File 'lib/code0/zero_track/database/column_methods.rb', line 14 def (**) [:null] = false if [:null].nil? %i[created_at updated_at].each do |column_name| column(column_name, :datetime_with_timezone, **) end end |