Sunday, September 2, 2018

Read replica database configurations, faster parameter filtering, and more!

Posted by eugeneius

Hello everyone! This is Eugene, bringing you the highlights from the last week of activity in the Rails codebase.

Add hooks to Active Job on retries and discards

Your application can now subscribe to be notified whenever a job is retried or discarded. Neat!

Support read replica database configurations

Database configurations can now be flagged as “replicas”, indicating that the database they connect to is read-only.

For now this just means they’re ignored by database tasks like db:create, but the comments on the pull request mention some other features that could be built on top of this change.

Reduce allocations during parameter filtering

Initially this patch looked like a micro-optimisation, but the author produced a benchmark which demonstrated saving 1% of both memory and time on a real world Rails app.

Find inverse associations with plural names

Previously, inverse associations would only be detected when they matched the model name exactly. Now, the case where they use the plural form of the model name will work too.

Clear mutation tracker after yielding in around callbacks

This change ensures that a record’s view of the database is up to date immediately after an around callback yields, just as it would be in an after callback.

21 people contributed to Rails this week; feel free to check out the full list of changes. If you want help out, maybe look for an interesting open issue?

Until next time!