Rails is Pretty Intuitive once you get used to it.

Patrick Wendo - Aug 21 '23 - - Dev Community

I am currently working with background jobs in Rails through Active Job. And I needed some code to run before the job starts. So I thought,

Typically when you are working with the controllers and you want to run some code before an action you have a before_action callback. In stimulus reflex, we have the before_reflex callback. It should be safe to assume that Active Job must have a before_perform callback

So I just set that up real quick and what do you know it run. I checked the docs just to make sure I was not having some vivid hallucination and true enough there is a before_perform callback, as well as a couple other useful ones.

This may not seem like much, but the ability to guesstimate what type of functions may be defined on a class is one of the few things I love about rails and ruby in general. It's like how the Enumerable class from which arrays, sets and hashes all inherit allows you to know that there are some methods that will always exist between these classes. And how a function ending in a question mark will return a boolean while one ending in an exclamation mark will do some potentially destructive action on whatever object calls it.

Rails and Ruby is pretty awesome when it comes to the developer experience.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .