4 ms·
the active record pattern, as it is commonly used, does not set you up well to lift individual components out of a monolith.
by jdc0589 5y ago
the active record pattern, as it is commonly used, does not set you up well to lift individual components out of a monolith.
- caspar 5y agoPerhaps you already have ideas on how to solve for this situation, but in case it helps: forcing active record model accesses to go via a layer of indirection can help with untangling this sort of thing: https://kellysutton.com/2019/10/29/taming-large-rails-codebases-with-private-activerecord-models.html https://kellysutton.com/2019/10/29/taming-large-rails-codeba... That said, for microservice extraction specifically, a bit of creative metaprogramming/monkey patching of AR to identify & categorize your callers is probably easier.
- jdc0589 5y agothe data access abstraction layer is absolutely the "right" move. just hard to stomach the amount of work involved that's ultimately kind of throw-away. the problem with activerecord is most people usually don't put this in place to begin with because the active record pattern makes it easy not to, which creates a massive pile of spaghetti code long term.