Halløj. It’s me again, bringing you the usual goodies from Rails.
Show relevant commands when calling help This pull request improves the user experience by displaying the appropriate commands for the context in which the user is running rails -h or rails. When outside of a Rails application, the output will be the options for the rails new command. When inside a Rails application, the common Rails commands will be displayed. This eliminates confusion for users who may have expected to see different commands in different contexts.
Let HWIA#transform_keys take a Hash argument like Ruby’s Hash#transform_keys The HashWithIndifferentAccess#transform_keys method now mirrors the functionality of Ruby’s Hash#transform_keys method by accepting a Hash argument.
Let delegate define method with proper arity when delegating to a class This change improves the delegate method by ensuring that the method being defined has the proper arity when delegating to a class. As a result, the defined method is significantly faster - up to 3.5 times faster when there are no arguments. However, it should be noted that in order to take advantage of this performance improvement, the target method being delegated to must be defined prior to declaring the delegation.
Add a default health controller This pull request introduces a new endpoint for load balancers and uptime monitors by adding a Rails::HealthController#show method and mapping it to the “/up” path in newly generated Rails applications. With this new endpoint, Load balancers and uptime monitors can easily track whether or not an app is up.
If, however, you need to monitor database, Redis or internal network connections to microservices that your application relies on, you will need to implement monitoring yourself.
Run test:prepare before bin/rails test commands This pull request streamlines the process of running all tests in a CI environment by making bin/rails test equivalent to bin/rake test when it comes to preparing tests. This means that running bin/rails test alone will now run all the tests, eliminating the need for the additional bin/rake test command.
However, it’s important to note that by default, running bin/rails test alone will not include system tests as they are generally slower. To include system tests as well, you can add an additional step to your CI pipeline that runs bin/rails test:system, or you can change your first step to bin/rails test:all which runs all the tests including the system tests.
Change dockerfile from using Node 19 to match dev environment This pull request improves the generated Dockerfile by installing the locally installed versions of Node and Yarn, decoupling the installation of libvips from Node, and adding the installation of node_modules by running yarn.
We had 33 contributors to Rails this week.
See you in the next issue!
Subscribe to get these updates mailed to you.