This Week in Rails

January 5, 2024

Omakase RuboCop, Brakeman, Ruby 3.1+, allow_browser, rate_limit, and more

Hi, zzak here with the first edition of This Week in Rails for 2024.
This year started off with a ton of contributions, nearly 170 commits, sorry we couldn’t fit everything in a single newsletter.

Rails UJS has been deprecated since Rails 7, time to die
While the official package "@rails/ujs" is still published on NPM, and the final compiled targets for the asset pipeline remain, all of the source files, tests, and internal packaging tasks were removed.

Add default PWA manifest and service worker file
Freshly generated Rails apps now include a manifest and service worker file to become full-fledged Progressive Web Applications.

Add rubocop-rails-omakase to new Rails applications
This setups a basic RuboCop config for new Rails apps using the rubocop-rails-omakase gem.

Add Brakeman by default to new apps
A newly generated Rails app also now includes Brakeman for enhanced security vulnerability checking.

Default to creating GitHub CI files
With the addition of RuboCop and Brakeman to new applications, we’ve also added default GitHub CI workflow files.

Add allow_browser to set minimum versions for your application
Now you can easily specify which browsers you’ve supported to allow access to your application.

Bump the required Ruby version to 3.1.0
The team is trying to stay ahead of the curve, and with Ruby 3.0 being EOL in March, now seems like a good time to bump that requirement.

Add rate limiting to Action Controller via the Kredis limiter type
Last, but certainly not least, we have a new API for rate limiting built into Action Controller which depends on the Kredis limiter type.

class SessionsController < ApplicationController
  rate_limit to: 10, within: 3.minutes, only: :create

class SignupsController < ApplicationController
  rate_limit to: 1000, within: 10.seconds,
    by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new

You can view the whole list of changes here. We had 40 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.