This week 28 people helped make Rails even more awesome than before. Big thank you to all these amazing people! If you'd like to chip in, there's always something you could help work on!
This is one of the many concurrency-related work that went into Rails this week.
Instead of forcing Rack::Lock when eager_load and cache_classes are off, this change just prevents actual race conditions.
It is achieved by means of a (reentrant) shared-exclusive lock. This allows multiple concurrent requests but ensures any code-loading activity gets performed in isolation.
ActiveSupport::Concurrency::Latch was replaced with Concurrent::CountDownLatch from the concurrent-ruby gem.
This replaces concurrency related code cluttered in AS and offloads it to concurrent-ruby gem, which has many concurrency utilities with runtime-specific optimizations.
This is to simplify the association API, as we can call reload on the association proxy or the parent object to get the same result.
So now to reload one would call @user.posts.reload instead of @user.posts(true) for collections and @user.reload.profile instead of @user.profile(true) for singular associations.
Inheriting from HashWithIndifferentAccess allowed users to call any enumerable methods on Parameters object, resulting in a risk of losing the permitted? status or even getting back a pure Hash object instead of a Parameters object with proper sanitization.
This change fixes this behavior and makes sure all the methods defined on Parameters will return a Parameters object with the correct permitted? flag.
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.