Rails introduces ErrorReporter#unexpected for reporting precondition violations

The new method will report in production but raise in other environments, making it easier to debug.

Upsert no longer ignores on_duplicate if unique_by is specified

Upsert would previously not execute the on_duplicate clause if the unique_by constraint found a match. This has been fixed.