Fix DateTime comparison with DateTime::Infinity object

Fixes #16406
Test using turbolinks master

See
https://github.com/rails/turbolinks/commit/153f1b0f04c718442cfd73365a2778dfe1a1c5c7
Define id_was to get the previous value of the primary key

Currently when we call id_was and we have a custom primary key name
Active Record will return the current value of the primary key. This
make impossible to correctly do an update operation if you change the
id.

Fixes #16413