Sunday, November 26, 2017

This Week in Rails: expiring counters, flush db connections, connection fork safety and more!

Posted by _cha1tanya

Hi! Prathamesh here! Let’s see what we have in store today from the Rails world.

This Week’s Contributors

This week we had 25 contributors. 8 of them were first time contributors!!!! 🎉

Support expiring counters for Memcached Store

This change adds supports for passing expires_in options to the #increment and #decrement methods of the Memcached  store.

Flush idle database connections automatically

A new configuration to flush the idle database connections after a specified period. Defaults to 300 seconds. This change will ensure that you don’t have idle database connections hanging around in your connection pool.

Improve Active Record connection fork safety

This change ensures that forked children don’t send quit/shutdown/goodbye messages to the server on connections that belonged to their parent. It will prevent the connection leakagethat might happen when connections are not closed when workers are forked from parent process.

Generate ids by default for form_with helper

When form_with was introduced the auto generation of ids was disabled. Labels don’t play well in such cases when the inputs don’t have ids and it also made it harder to test the forms. This change enables the auto-generation of ids by default and allows to disable it using a config.

Pass informative arguments to all calls of ActiveRecord::RecordNotFound error

ActiveRecord::RecordNotFoundError accepts arguments such as primary_key, model_name and the arguments besides the error message. This change makes all the calls to this error uniform by passing these arguments wherever they were missing.

Make secure_compare method not leak length information

This change makes sure that even in case of variable length strings, the ActiveSupport::SecurityUtils.secure_compare doesn’t leak the length information.

That’s all we’ve got for this week, but do check out the full list of changes yourself. Over and out! See you next week ✌️