Friday, March 1, 2024

Added fixture method and bugfixes

Posted by Wojtek

Hi, Wojtek from this side. Let’s explore this week’s few changes in the Rails codebase.

Rails security update releases
Rails Versions 6.1.7.7, 7.0.8.1, and 7.1.3.2 have been released last week which contain fixes for security issues.

Expose a generic “fixture” method in tests
To avoid conflicting methods, in example with Minitest, it is possible now to load fixtures like this:

assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name

Introduce assert_initializer
Compliments the existing initializer generator action.

Set default_url_options values in development/test environments
Prior to this commit, new Rails applications would raise ActionView::Template::Error if a mailer included a url built with a *_path helper.

Fix error message for not derived foreign key in Active Record
Using query_constraints method with a single non-primary-key column used to raise as expected, but with an incorrect error message. This has been fixed to raise with a more appropriate error message.

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

Until next time!

Subscribe to get these updates mailed to you.