This week in Rails: goodbye Rack::Lock, concurrent-ruby, better AC::Parameters and more

Posted by vipulnsward, July 17, 2015 @ 10:25 pm in News

#

Hello Everyone!

This is Vipul from Pune, waiting to enjoy some sweet Sheer khurma, and delicious Biryani with my friends, since Eid is just around the corner.

Hmm, Yum.

This week’s Rails contributors

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!

New Stuff

Remove Rack::Lock

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.

Improved

Replace ActiveSupport::Concurrency::Latch with Concurrent::CountDownLatch from concurrent-ruby

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.

Deprecate force association reload by passing true

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.

See also this mailing list thread for more background information.

Fixed

Test runner now works correctly inside Engines

The bin/rails test has now been extended to work properly instead engines, where previously we needed to do rake test.

ActionController::Parameters no longer inherits from HashWithIndifferentAccess

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.

You up for that? Tell Godfrey today.