This Week in Rails

February 2, 2024

Deprecation, bugfixes and more!

Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.

Deprecate passing nil as model argument
Passing model: nil as an argument to the form_with method will be deprecated in the next release of Rails.

Skip CSS when creating APIs
This pull request makes the Rails generator skip the CSS part if the --api flag is set, because CSS is unnecessary for API only apps.

Commented out lines in .railsrc file should not be treated as arguments
Before this change, commented out lines in the .railsrc file were parsed as arguments if the commented part had any arguments inside. This pull request fixes that.

Add row_count field to sql.active_record notification
This pull request adds a row_count field to the sql.active_record notification, which returns the amount of rows returned by the query that emitted the notification.
This metric is useful in cases where one wants to detect queries with big result sets.

Allow encryption without compression
This pull request adds an option to ActiveRecord::Encryption::Encryptor to disable compression:
class User
  encrypts :name, encryptor: ActiveRecord::Encryption::Encryptor.new(compress: false)
end

You may want to avoid compression if your data is already compressed, or to prevent revealing information about the entropy of the encrypted value.

You can view the whole list of changes here. We had 25 contributors to the Rails codebase this past week!

Until next time!

About This Week in Rails

Your weekly inside scoop of interesting commits, pull requests and more from Rails.