AR .persisted? throws SystemStackError for an unsaved model with a
custom primary_key that didn't save due to validation error
Merge pull request #14393 from chrisfinne/persisted_exception

AR .persisted? throws SystemStackError for an unsaved model with a
custom primary_key that didn't save due to validation error