_ValueOrPrimary returns Record objects
In some cases, the
_ValueOrPrimary method will still return a
This happens when the primary key of the Record being saved (as value) is itself a Record. The correct behavior is to continue getting the key of the Record until a non-record value is found instead.
Added a functioning 'pop' method to the Record class, which works using the automatic loading of references. Method GetRaw has been added to return the raw value of a field, suppressing autoloading. Also fixed the bug where if a primary key was another record, the record would be inserted in the database instead of that primary key. This resolves #1015.