Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Ruby on Rails/ActiveRecord/Timestamps

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Active Record automatically timestamps during create and update operations if the table has fields created_at/created_on or updated_at/updated_on. This can be disabled on individual models by setting @self.record_timestamps = false@ in the class definition for the model. For example: class SomeModel < ActiveRecord::Base self.record_timestamps = false end Although there is no explicit requirement, typically the _on fields should be date types, whereas the _at fields should be datetime types. Timestamps are in the local timezone by default but can use UTC by setting ActiveRecord::Base.default_timezone = :utc. This will normally be specified in config/environment.rb. Source: active_record/timestamp.rb