DEV Community

Discussion on: Working Around ActiveRecord Callbacks

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

Used in moderation callbacks work well, but with this greener workforce entering the market it's hard to imbue this discipline of practicality so we can avoid abstractions.

I like this practical implementation as oppose to Services Object which never seem to get implemented correctly.

Collapse
 
supergoodjared profile image
Jared Norman

The term "service object" is pretty overloaded and means a lot of things to different people, but it's still my goto technique for managing this particular kind of complexity.

Alternatively, if you app is still very CRUD-y, wrapping things like "address creation" in their own special ActiveModel::Model object can be really nice since you can still interact with it roughly the same way you would any other resource. It's certainly a nice option especially for less complex apps that don't necessarily have a preferred pattern for pulling out logic into POROs.