Started trying out @kaspth's Associated Object gem, and I'm really digging it as a way to organize model logic. I'm only scratching the surface of using it so far, but it's delivering as advertised. https://github.com/kaspth/active_record-associated_object

Was having so much fun, I started a rough generator to make it a little faster, and Kasper already polished it up and created a PR. https://github.com/kaspth/active_record-associated_object/pull/23

#Rails #Generators

GitHub - kaspth/active_record-associated_object: Extract Collaborator Objects from your Active Records, a new concept called Associated Objects

Extract Collaborator Objects from your Active Records, a new concept called Associated Objects - kaspth/active_record-associated_object

GitHub

@garrettdimon @kaspth @jamie From the README:

"But sometimes app/services can turn into another junk drawer that doesn't help you build and make concepts for your Domain Model."

"sometimes"?????! 😂

Interesting idea.

Also I like that they're focused around a particular model. As a concept, it could help serve as a reminder to prevent Service object that all too easily become some of the worst examples of the Mediator pattern that I've ever seen (or written because I suck too).

And, I suppose, there are legitimate cases (see: complicated business processes) where you may legitimately just need a Whole Bunch O' Different Model Objects™️ to achieve an objective. But I've seen this become the bulk of app business logic way too often over the past 10 years.

@garrettdimon @kaspth @jamie Oof but that brings back some painful memories...