Guten Tag! Emmanuel here again, with some updates from Rails.
Don’t trigger after_commit :destroy callback again on destroy if record previously was destroyed
The after_commit :destroy callback would always run even if a record was destroyed previously. This PR fixes that. Essentially, we don’t want to call after_commit :destroy on unpersisted records.
Allow ErrorReporter to handle several error classes
ErrorReporter now allows you to handle several error classes in one go. You can now handle multiple error classes like so:
Rails.error.handle(ArgumentError, TypeError) do
# Do some work
end Fix ciphertext_for for yet-to-be-encrypted values
ciphertext_for should return the encrypted value of an attribute that’s encrypted even when the record has not been persisted, before this commit, this wasn’t what we were getting, instead, for an unpersisted record, ciphertext_for returned the plain text value of the attribute. This PR fixes that.
Avoid unnecessary serialize calls after save
We’ve got some performance gains with this one: This commit memoizes value_for_database so that serialize is not called a 2nd time after save. Because value is the single source of truth and can change in place, the memoization carefully checks for when value differs from the memoized @value_for_database. Verbatim from the commit message. 😎
Allow ActiveRecord::QueryMethods#reselect to accept a hash
This PR allows ActiveRecord::QueryMethods#reselect to receive hash values, similar to this PR that allowed ActiveRecord::QueryMethods#select to accept hashes.
21 contributors improved Rails in the past week. We’ll bring you more updates next week!
Subscribe to get these updates mailed to you.