ActiveRecord is one of the most useful utilities in the Rails toolkit.
It allows us to perform complex database queries while abstracting the adapter,
essentially making a database “pluggable”.
some edge cases stand out like a sore thumb.
One such query is the ability to set values to the standard Rails
timestamps which are available across models.
In a typical model insertion,
one does not need to actively set values for the timestamps.
They are set by the underlying framework at the time of insertion.
One would expect consistent action across similar queries.
Let’s have a look at mass insertion queries.
It raises an unexpected exception ActiveRecord::NotNullViolation,
since a database constraint is present on the created_at column.
This leaves us with only one option — manually providing values for all timestamp columns.