Friday, April 19, 2019

Performance improvements, collection cache versioning and more

Posted by morgoth85

Hello. This is Wojtek reporting on recent changes from Rails world.

Collection cache versioning

Add cache_version on relation to support recyclable cache keys via the versioned entries in ActiveSupport::Cache. This also means that cache_key will now return a stable key that does not include the max timestamp or count any more.

Speed up dirty tracking

Reports 2x ~ 30x faster execution time compared to original implementation.

Add dirty methods for store accessors

It is now possible to use methods defined by Dirty module on store accessors.

Add after_save_commit callback shortcut

Adds shortcut for very common case:

after_commit :hook, on: [ :create, :update ]

Notes tags registration

It is now possible to register custom tags that will be included on bin/rails notes command.

Add db:prepare rake task

Based on state of database it runs setup or migrate tasks.

Add detach_from to ActiveSupport::Subscriber

It is now possible to opt-out from listening on chosen events.

Factorize bin/update in bin/setup

Replaced two files with one. From now on bin/setup should be idempotent in the project, thus should run fine on the first time setup and after any update.

71 people contributed to Rails in the last 3 weeks. You can see the full list of changes here.

Until next time!