Rails applications that separate ActiveRecord from business logic

I recently stumbled upon Robert Martin (Uncle Bob), which talks about how to structure a case-based rails application. I found this very interesting.

Here is the link to the main label: Architecture: Lost Years

Here is an example project that structures an application based on the principles mentioned by Robert Martin in his keyword: Watch Guru

I was wondering if there are well-proven rail applications that are structured in this way (Case Driven Approach / Entity-Control-Boundary approach / decoupling from the interface)

+4
source share
1 answer

Well, I can’t share this code, but I can point you in some direction. We used this stone in our application: https://github.com/collectiveidea/interactor .

I was very inspired by Martin's keynote, and the development of this application went pretty well :). In the case of separation of ActiveRecord and Business Logic, we did the following:

Each class in our business logic has something to do with the DatabaseEntity counterpart. This analogue used a different class - our adapter for ActiveRecord. He requested the appropriate ActiveRecord model and converted ActiveRecord instances to instances of our business logic classes.

In the end, most of the code was concentrated in this adapter.

+1
source

All Articles