Rails 8 includes everything you need to run and monitor background jobs. I found this feature to be incredibly relevant.

· rails  · 2 min read

Background jobs with Rails 8 are delightful

Rails 8 includes everything you need to run and monitor background jobs. I found this feature to be incredibly relevant.

There’s one thing I forgot to mention about my Rails 8 opinion last time : it’s how background jobs are handled in Rails 8.

Example

Here’s what it looks like on my current project :

image of mission control

Background jobs should be a default feature

Most web frameworks completely underestimate how background jobs are valuable.

Honestly I always need a way to handle background jobs, on every new web project.

  • Forgot password email ? => background task to send the email
  • Clean image asynchronously ? => background task to clean the image

And so on.

IMHO A good way go see if a framework is mature enough is “are background jobs already included from day 1”.

Why it’s delightful with Rails 8

Why it is so good with Rails 8?

Because you don’t have to care about : it’s already included.

From what I’ve read, it’s not possible with other frameworks - outside Laravel.

  • The Database is already backed
  • The Dashboard is already included (!)
  • And, of course, it’s damn easy to hook any kind of job inside the framework itself.

All I had to do is to protect the route, so that only the admin can view it.

You don’t have to care about internals because it just works

You don’t have to care about the JS/CSS, because as long as you keep “propshaft” as gem, it will work.

The beauty (again) is that I don’t use propshaft myself. I use Vite.

This is Rails deep integration : even if you don’t use the default frontend management, external gem will work with your product.

Two different processes

Of course “background jobs” means “take another thread than the one of the web server”.

So there’s a tiny configuration locally (Thank you Matt Brictson for your bin/dev ), and another one for the production, but honestly, it’s one line of code that you can forget once properly set up.

Summary

Rails 8 shine not only for the things previously mentionned, but also thanks to mission control.

It gives you very elegant, monitor-able background jobs, right from day one, with full support and upgrades of the Rails maintainers.

Close from silver bullet ;)

Share:
Back to Blog

Related Posts

View All Posts »
Rails 8 Hotwire, a tutorial

Rails 8 Hotwire, a tutorial

Rails 8 comes with Hotwire by default to handle frontend complexity. Here is a simple tutorial from scratch.

Ruby-on-Rails ERB vs HAML

Ruby-on-Rails ERB vs HAML

This is an opinionated article about ERB and HAML with Rails. Let's compare each other and pick a winner.