rails/rails — pull request #14393 by chrisfinne (2014-03-15 11:22:11+00:00)
Title: AR .persisted? throws SystemStackError for an unsaved model with a custom primary_key that didn't save due to validation error

See this for a mini test:
https://gist.github.com/chrisfinne/9564807

While just looking at the test, it doesn't seem like you'd see this very often, but if you
1. have a Model with a custom primary_key
2. have vanilla rails scaffolding
3. POST the form to create a new record
4. any validation fails
5. the controller renders the 'new' template which renders the '_form' partial
6. form_for(@my_model) is called from the partial
7. form_for checks .persisted?
8. SystemStackError exception