What's up, gang? Todd here with another edition of This Week in Rails. It was a bit of a quiet week in Railsland, but I think we've got some quality contributions here. Read on for the deets!
This addition bakes a strategy for generating collection cache keys directly into ActiveRecord::Relation. Using #cache_key, it's now possible to automagically generate a unique key on relations for use with Rails' fragment cache.
Per a request from DHH, this change adds the ability to enable or disable caching in a development environment. There are two ways to toggle it - on server start with --[no-]dev-caching or with the dev:cache rake task.
By using #start_with? instead of matching on a regex, 765.5 ms have been shaved off of the total aggregate request time per 1000 requests. In conjunction with other performance work recently completed, this knocks a whopping 1.5 seconds off over the course of 1000 requests.
That's a wrap
That's all for This week in Rails. As always, there are many more changes than we have room to cover here, but feel free to check them out yourself!
Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.