Hi, this is Greg and Robin, bringing you the latest news from the Rails world.
Dart Sass for Rails
As Ruby Sass has been deprecated a long time ago and since Webpacker has been retired, a new gem that wraps the standalone executable version of the Dart version of Sass has been released and makes it easy to use Sass stylesheets with Rails 7.
Add ActiveSupport::TestCase#stub_const
As some sort of syntax sugar, a new #stub_const method has been added to easily change the value of a constant for the duration of a block, silencing warnings. The implementation is not thread-safe if you have parallel testing enabled though.
Improve error message using #associated with no reflection
Using where.associated with a missing association used to raise a cryptic error message; this has now been improved with a much clearer message.
Optimize Object#instance_values
The performance of as_json have been improved by using Array#to_h instead of Hash::[] and freezing the strings so Hash#[] doesn’t have to dup them. Another patch has also been merged to reduce the number of allocations done calling this method.
Improve ActiveModel::Name#human performance
Other performance improvements have been made on model name translation when a translation is missing. The trick here is pretty simple: caching. Another patch that improves performances on #human_attribute_name has been merged as well.
Expand documentation on bi-directional associations
As we are continuously learning, we might forget how it felt when we begun. This pull request improves documentation on bi-directional associations with some concrete examples that might be useful for new learners. Lovely!
Make ActiveRecord::ConnectionPool Fiber-safe
Last but not least, the Active Record connection pool is now fiber-safe. It now honors the value of your config.active_support.isolation_level to either rely on threads or fibers. This should give you better throughput on fiber-oriented servers like Falcon.
Since last time, 38 people contributed to Rails. As usual, there’s too much changes to cover them but you can check out all of these here. Until next time!